-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Adamska1008/13-feature-add-support-for-pa…
…rsing-cdata-sections feat(cdata.cpp): support parsing CDATA
- Loading branch information
Showing
13 changed files
with
149 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include "myxml/node.hpp" | ||
|
||
namespace myxml | ||
{ | ||
class CData : public Node | ||
{ | ||
private: | ||
std::string inner; | ||
|
||
public: | ||
explicit CData(std::string); | ||
|
||
virtual ~CData() = default; | ||
virtual std::string ExportRaw() const override; | ||
virtual std::string ExportFormatted(int indentLevel = 0, int indentSize = 4) const override; | ||
virtual void SetEntityEncoding(bool) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <fmt/core.h> | ||
#include "myxml/cdata.hpp" | ||
|
||
namespace myxml | ||
{ | ||
CData::CData(std::string str) | ||
: inner(str) | ||
{ | ||
} | ||
|
||
std::string CData::ExportRaw() const | ||
{ | ||
return fmt::format("<![CDATA[{}]]>\n", this->inner); | ||
} | ||
|
||
std::string CData::ExportFormatted(int indentLevel, int indentSize) const | ||
{ | ||
return std::string(indentLevel * indentSize, ' ') + this->ExportRaw(); | ||
} | ||
|
||
void CData::SetEntityEncoding(bool) | ||
{ // do nothing | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.