convert Pair to std::pair
This is C++11 now. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
e93ad82734
commit
5a4c3cd057
@ -1001,7 +1001,7 @@ namespace Jzon
|
||||
else
|
||||
{
|
||||
// Store the unknown token, so we can show it to the user
|
||||
data.push(MakePair(Value::VT_STRING, valueBuffer));
|
||||
data.push(std::make_pair(Value::VT_STRING, valueBuffer));
|
||||
tokens.push(T_UNKNOWN);
|
||||
}
|
||||
|
||||
@ -1022,7 +1022,7 @@ namespace Jzon
|
||||
}
|
||||
bool Parser::assemble()
|
||||
{
|
||||
std::stack<Pair<std::string, Node*> > nodeStack;
|
||||
std::stack<std::pair<std::string, Node*> > nodeStack;
|
||||
|
||||
std::string name = "";
|
||||
|
||||
@ -1059,7 +1059,7 @@ namespace Jzon
|
||||
node = new Object;
|
||||
}
|
||||
|
||||
nodeStack.push(MakePair(name, node));
|
||||
nodeStack.push(std::make_pair(name, node));
|
||||
name.clear();
|
||||
break;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@ namespace Jzon
|
||||
node = new Array;
|
||||
}
|
||||
|
||||
nodeStack.push(MakePair(name, node));
|
||||
nodeStack.push(std::make_pair(name, node));
|
||||
name.clear();
|
||||
break;
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ namespace Jzon
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeStack.push(MakePair(name, node));
|
||||
nodeStack.push(std::make_pair(name, node));
|
||||
name.clear();
|
||||
}
|
||||
}
|
||||
@ -1256,7 +1256,7 @@ namespace Jzon
|
||||
c1 = c2;
|
||||
}
|
||||
|
||||
data.push(MakePair(Value::VT_STRING, str));
|
||||
data.push(std::make_pair(Value::VT_STRING, str));
|
||||
}
|
||||
bool Parser::interpretValue(const std::string &value)
|
||||
{
|
||||
@ -1266,15 +1266,15 @@ namespace Jzon
|
||||
|
||||
if (upperValue == "NULL")
|
||||
{
|
||||
data.push(MakePair(Value::VT_NULL, std::string("")));
|
||||
data.push(std::make_pair(Value::VT_NULL, std::string("")));
|
||||
}
|
||||
else if (upperValue == "TRUE")
|
||||
{
|
||||
data.push(MakePair(Value::VT_BOOL, std::string("true")));
|
||||
data.push(std::make_pair(Value::VT_BOOL, std::string("true")));
|
||||
}
|
||||
else if (upperValue == "FALSE")
|
||||
{
|
||||
data.push(MakePair(Value::VT_BOOL, std::string("false")));
|
||||
data.push(std::make_pair(Value::VT_BOOL, std::string("false")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1290,7 +1290,7 @@ namespace Jzon
|
||||
|
||||
if (number)
|
||||
{
|
||||
data.push(MakePair(Value::VT_NUMBER, value));
|
||||
data.push(std::make_pair(Value::VT_NUMBER, value));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -40,31 +40,12 @@ THE SOFTWARE.
|
||||
|
||||
namespace Jzon
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable : 4251)
|
||||
#endif
|
||||
|
||||
template<typename T1, typename T2>
|
||||
struct Pair
|
||||
{
|
||||
Pair(T1 first, T2 second) : first(first), second(second)
|
||||
{}
|
||||
|
||||
T1 first;
|
||||
T2 second;
|
||||
};
|
||||
template<typename T1, typename T2>
|
||||
static Pair<T1, T2> MakePair(T1 first, T2 second)
|
||||
{
|
||||
return Pair<T1, T2>(first, second);
|
||||
}
|
||||
|
||||
class Node;
|
||||
class Value;
|
||||
class Object;
|
||||
class Array;
|
||||
typedef Pair<std::string, Node&> NamedNode;
|
||||
typedef Pair<std::string, Node*> NamedNodePtr;
|
||||
using NamedNode = std::pair<std::string, Node&>;
|
||||
using NamedNodePtr = std::pair<std::string, Node*>;
|
||||
|
||||
class TypeException : public std::logic_error
|
||||
{
|
||||
@ -449,7 +430,7 @@ namespace Jzon
|
||||
std::size_t jsonSize;
|
||||
|
||||
std::queue<Token> tokens;
|
||||
std::queue<Pair<Value::ValueType, std::string> > data;
|
||||
std::queue<std::pair<Value::ValueType, std::string> > data;
|
||||
|
||||
std::size_t cursor;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user