Browse Source

Remove handling of data binding in xml parser

Michael Ragazzon 6 years ago
parent
commit
8fdcf5aab0
4 changed files with 0 additions and 64 deletions
  1. 0 5
      Include/RmlUi/Core/Factory.h
  2. 0 11
      Include/RmlUi/Core/XMLParser.h
  3. 0 22
      Source/Core/Factory.cpp
  4. 0 26
      Source/Core/XMLParser.cpp

+ 0 - 5
Include/RmlUi/Core/Factory.h

@@ -42,7 +42,6 @@ class DecoratorInstancer;
 class Element;
 class ElementDocument;
 class ElementInstancer;
-class ElementText;
 class Event;
 class EventInstancer;
 class EventListener;
@@ -104,10 +103,6 @@ public:
 	/// @param[in] text The text to instance the element (or elements) from.
 	/// @return True if the string was parsed without error, false otherwise.
 	static bool InstanceElementText(Element* parent, const String& text);
-	/// Instances a single text element with no text contents.
-	/// @param[in] parent The element any instanced elements will be parented to.
-	/// @return The instanced text element if successful, nullptr otherwise.
-	static ElementText* InstanceElementText(Element* parent);
 	/// Instances an element tree based on the stream.
 	/// @param[in] parent The element the stream elements will be added to.
 	/// @param[in] stream The stream to read the element RML from.

+ 0 - 11
Include/RmlUi/Core/XMLParser.h

@@ -40,8 +40,6 @@ class DocumentHeader;
 class Element;
 class XMLNodeHandler;
 class URL;
-class DataModel;
-class Context;
 
 /**
 	RmlUi's XML parsing engine. The factory creates an instance of this class for each RML parse.
@@ -84,8 +82,6 @@ public:
 
 		// The default handler used for this frame's children.
 		XMLNodeHandler* child_handler = nullptr;
-
-		DataModel* data_model = nullptr;
 	};
 
 	/// Pushes an element handler onto the parse stack for parsing child elements.
@@ -99,9 +95,6 @@ public:
 	/// @return The parser's current parse frame.
 	const ParseFrame* GetParseFrame() const;
 
-	/// Get the data model name for the current frame.
-	DataModel* GetDataModel() const;
-
 protected:
 	/// Called when the parser finds the beginning of an element tag.
 	void HandleElementStart(const String& name, const XMLAttributes& attributes) override;
@@ -117,10 +110,6 @@ private:
 	// The active node handler.
 	XMLNodeHandler* active_handler;
 
-	DataModel* active_data_model;
-
-	Context* root_context;
-
 	// The parser stack.
 	using ParserStack = std::stack< ParseFrame >;
 	ParserStack stack;

+ 0 - 22
Source/Core/Factory.cpp

@@ -395,28 +395,6 @@ bool Factory::InstanceElementText(Element* parent, const String& text)
 	return true;
 }
 
-ElementText* Factory::InstanceElementText(Element* parent)
-{
-	XMLAttributes attributes;
-	ElementPtr element = Factory::InstanceElement(parent, "#text", "#text", attributes);
-	if (!element)
-	{
-		Log::Message(Log::LT_ERROR, "Failed to instance text element, instancer returned nullptr.");
-		return nullptr;
-	}
-
-	ElementText* text_element = rmlui_dynamic_cast<ElementText*>(element.get());
-	if (!text_element)
-	{
-		Log::Message(Log::LT_ERROR, "Failed to instance text element. Found type '%s', was expecting a derivative of ElementText.", rmlui_type_name(*element));
-		return nullptr;
-	}
-
-	parent->AppendChild(std::move(element));
-
-	return text_element;
-}
-
 // Instances a element tree based on the stream
 bool Factory::InstanceElementStream(Element* parent, Stream* stream)
 {

+ 0 - 26
Source/Core/XMLParser.cpp

@@ -51,9 +51,7 @@ XMLParser::XMLParser(Element* root)
 	frame.element = root;
 	stack.push(frame);
 
-	root_context = (root ? root->GetContext() : nullptr);
 	active_handler = nullptr;
-	active_data_model = nullptr;
 
 	header = new DocumentHeader();
 }
@@ -119,11 +117,6 @@ const XMLParser::ParseFrame* XMLParser::GetParseFrame() const
 	return &stack.top();
 }
 
-DataModel* XMLParser::GetDataModel() const
-{
-	return active_data_model;
-}
-
 /// Called when the parser finds the beginning of an element tag.
 void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& attributes)
 {
@@ -138,22 +131,6 @@ void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& att
 	// Store the current active handler, so we can use it through this function (as active handler may change)
 	XMLNodeHandler* node_handler = active_handler;
 
-	// Look for the data model attribute
-	if (root_context)
-	{
-		static const String data_model = "data-model";
-		auto it = attributes.find(data_model);
-		if (it != attributes.end())
-		{
-			String data_model = it->second.Get<String>();
-
-			active_data_model = root_context->GetDataModel(data_model);
-
-			if (!active_data_model)
-				Log::Message(Log::LT_WARNING, "Could not locate data model '%s'.", data_model.c_str());
-		}
-	}
-
 	Element* element = nullptr;
 
 	// Get the handler to handle the open tag
@@ -168,7 +145,6 @@ void XMLParser::HandleElementStart(const String& _name, const XMLAttributes& att
 	frame.child_handler = active_handler;
 	frame.element = (element ? element : stack.top().element);
 	frame.tag = name;
-	frame.data_model = active_data_model;
 	stack.push(frame);
 }
 
@@ -184,8 +160,6 @@ void XMLParser::HandleElementEnd(const String& _name)
 	stack.pop();
 	// Restore active handler to the previous frame's child handler
 	active_handler = stack.top().child_handler;	
-	// Restore the active data model to the current frame's model
-	active_data_model = stack.top().data_model;
 
 	// Check frame names
 	if (name != frame.tag)