start changing the Space API

removed table_single from Space



git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1065 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2017-06-27 16:51:55 +00:00
parent 62f16ecb1b
commit cde990ba82
9 changed files with 253 additions and 400 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2013, Tomasz Sowa
* Copyright (c) 2012-2017, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -77,9 +77,6 @@ private:
void Serialize(Space & space, Stream & out, bool use_indents, int level,
bool use_comma, bool treat_as_table, bool skip_name);
template<class Stream>
void SerializeTableSingle(Space & space, Stream & out, bool use_indents, int level, bool use_comma);
template<class Stream>
void SerializeTableMulti(Space & space, Stream & out, bool use_indents, int level, bool use_comma);
@@ -144,38 +141,6 @@ void SpaceToJSON::PrintToken(Stream & out, const StringType & str, bool is_speci
template<class Stream>
void SpaceToJSON::SerializeTableSingle(Space & space, Stream & out, bool use_indents, int level, bool use_comma)
{
Space::TableSingle::const_iterator i;
size_t index = 0;
bool is_special;
if( use_comma && !space.table_single.empty() )
{
PrintLevel(out, use_indents, level);
out << L",\n";
}
for(i=space.table_single.begin() ; i != space.table_single.end() ; ++i, ++index)
{
is_special = IsNumeric(i->first) || IsBool(i->first);
PrintLevel(out, use_indents, level);
PrintToken(out, i->first);
out << L": ";
PrintToken(out, i->second, is_special);
if( index + 1 < space.table_single.size() )
out << ',';
out << '\n';
}
}
template<class Stream>
void SpaceToJSON::SerializeTableMulti(Space & space, Stream & out, bool use_indents, int level, bool use_comma)
{
@@ -257,10 +222,9 @@ void SpaceToJSON::Serialize(Space & space, Stream & out, bool use_indents, int l
if( !treat_as_table )
{
SerializeTableSingle(space, out, use_indents, level, false);
SerializeTableMulti(space, out, use_indents, level, !space.table_single.empty());
SerializeTableMulti(space, out, use_indents, level, false);
if( !space.table_single.empty() || !space.table.empty() )
if( !space.table.empty() )
printed_something = true;
}