mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 20:51:16 +00:00
Converted indexing to std::size_t, and fixed the Node templated overloads to properly index any index type (determining what is an index type is a bit of a hack - it should be is_convertible<T, std::size_t> (I think), but I just explicitly wrote down a list)
This commit is contained in:
28
src/node.cpp
28
src/node.cpp
@@ -126,7 +126,7 @@ namespace YAML
|
||||
|
||||
m_tag = state.TranslateTag(token.value);
|
||||
|
||||
for(unsigned i=0;i<token.params.size();i++)
|
||||
for(std::size_t i=0;i<token.params.size();i++)
|
||||
m_tag += token.params[i];
|
||||
pScanner->pop();
|
||||
}
|
||||
@@ -209,7 +209,7 @@ namespace YAML
|
||||
// size
|
||||
// . Returns the size of this node, if it's a sequence node.
|
||||
// . Otherwise, returns zero.
|
||||
unsigned Node::size() const
|
||||
std::size_t Node::size() const
|
||||
{
|
||||
if(!m_pContent)
|
||||
return 0;
|
||||
@@ -217,28 +217,12 @@ namespace YAML
|
||||
return m_pContent->GetSize();
|
||||
}
|
||||
|
||||
const Node& Node::operator [] (unsigned u) const
|
||||
const Node *Node::FindAtIndex(std::size_t i) const
|
||||
{
|
||||
if(!m_pContent)
|
||||
throw BadDereference();
|
||||
|
||||
Node *pNode = m_pContent->GetNode(u);
|
||||
if(pNode)
|
||||
return *pNode;
|
||||
|
||||
return GetValue(u);
|
||||
}
|
||||
|
||||
const Node& Node::operator [] (int i) const
|
||||
{
|
||||
if(!m_pContent)
|
||||
throw BadDereference();
|
||||
|
||||
Node *pNode = m_pContent->GetNode(i);
|
||||
if(pNode)
|
||||
return *pNode;
|
||||
|
||||
return GetValue(i);
|
||||
return 0;
|
||||
|
||||
return m_pContent->GetNode(i);
|
||||
}
|
||||
|
||||
bool Node::GetScalar(std::string& s) const
|
||||
|
Reference in New Issue
Block a user