Skip to content

Commit

Permalink
Removed underscore private methods and unused CountOccurances method
Browse files Browse the repository at this point in the history
  • Loading branch information
tinfoilboy committed Dec 9, 2018
1 parent 7eb136d commit 0b8ba53
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions include/ctml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ namespace CTML
m_content = name;

// escape all of the content text for common characters
m_content = _ReplaceAllOccurrences(m_content, "&", "&");
m_content = _ReplaceAllOccurrences(m_content, "<", "&lt;");
m_content = _ReplaceAllOccurrences(m_content, ">", "&gt;");
m_content = _ReplaceAllOccurrences(m_content, "\"", "&quot;");
m_content = _ReplaceAllOccurrences(m_content, "'", "&apos;");
m_content = ReplaceAllOccurrences(m_content, "&", "&amp;");
m_content = ReplaceAllOccurrences(m_content, "<", "&lt;");
m_content = ReplaceAllOccurrences(m_content, ">", "&gt;");
m_content = ReplaceAllOccurrences(m_content, "\"", "&quot;");
m_content = ReplaceAllOccurrences(m_content, "'", "&apos;");
}
else if (type == NodeType::ELEMENT)
{
Expand Down Expand Up @@ -249,7 +249,7 @@ namespace CTML

elementName = name.substr(0, startIndex);

_ParseClassesAndIDS(name.substr(startIndex));
ParseClassesAndIDS(name.substr(startIndex));
}

this->m_name = elementName;
Expand Down Expand Up @@ -536,7 +536,7 @@ namespace CTML
/**
* Replace every occurrence of a string within a string using the specified replace.
*/
std::string _ReplaceAllOccurrences(std::string& replacer, const std::string& replacable, const std::string& replace) const
std::string ReplaceAllOccurrences(std::string& replacer, const std::string& replacable, const std::string& replace) const
{
size_t start = 0;

Expand All @@ -550,22 +550,7 @@ namespace CTML
return replacer;
}

size_t _CountOccurrences(std::string& finder, const std::string& findable) const
{
size_t occurrences = 0;
size_t start = 0;

// while not at the end of the string, count up one occurrence
while ((start = finder.find(findable, start)) != std::string::npos)
{
occurrences++;
start += findable.length();
}

return occurrences;
}

void _ParseClassesAndIDS(const std::string& input)
void ParseClassesAndIDS(const std::string& input)
{
NodeParserState state = NodeParserState::NONE;
std::string temp = "";
Expand Down

0 comments on commit 0b8ba53

Please sign in to comment.