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:
@@ -40,7 +40,7 @@ namespace YAML
|
||||
// accessors
|
||||
Iterator begin() const;
|
||||
Iterator end() const;
|
||||
unsigned size() const;
|
||||
std::size_t size() const;
|
||||
|
||||
// extraction of scalars
|
||||
bool GetScalar(std::string& s) const;
|
||||
@@ -55,19 +55,17 @@ namespace YAML
|
||||
template <typename T>
|
||||
friend void operator >> (const Node& node, T& value);
|
||||
|
||||
// just for maps
|
||||
// retrieval for maps and sequences
|
||||
template <typename T>
|
||||
const Node *FindValue(const T& key) const;
|
||||
const Node *FindValue(const char *key) const;
|
||||
|
||||
|
||||
template <typename T>
|
||||
const Node& operator [] (const T& key) const;
|
||||
|
||||
// specific to maps
|
||||
const Node *FindValue(const char *key) const;
|
||||
const Node& operator [] (const char *key) const;
|
||||
|
||||
// just for sequences
|
||||
const Node& operator [] (unsigned u) const;
|
||||
const Node& operator [] (int i) const;
|
||||
|
||||
// for anchors/aliases
|
||||
const Node *Identity() const { return m_pIdentity; }
|
||||
bool IsAlias() const { return m_alias; }
|
||||
@@ -81,10 +79,17 @@ namespace YAML
|
||||
friend bool operator < (const Node& n1, const Node& n2);
|
||||
|
||||
private:
|
||||
// helper for sequences
|
||||
template <typename, bool> friend struct _FindFromNodeAtIndex;
|
||||
const Node *FindAtIndex(std::size_t i) const;
|
||||
|
||||
// helper for maps
|
||||
template <typename T>
|
||||
const Node& GetValue(const T& key) const;
|
||||
|
||||
|
||||
template <typename T>
|
||||
const Node *FindValueForKey(const T& key) const;
|
||||
|
||||
// helpers for parsing
|
||||
void ParseHeader(Scanner *pScanner, const ParserState& state);
|
||||
void ParseTag(Scanner *pScanner, const ParserState& state);
|
||||
|
Reference in New Issue
Block a user