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:
Jesse Beder
2009-08-19 20:58:07 +00:00
parent ba11f5ae15
commit 81c2e6b6ca
17 changed files with 134 additions and 78 deletions

View File

@@ -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