Code Migration

- Migrated taskd JSON parser into task, to provide encode/decode
  capability to Task::composeJSON.
- Migrated taskd utf8 code, replacing old unused code.
- Added unit tests or JSON.
- Migrated Tree updates from taskd.
This commit is contained in:
Paul Beckingham
2011-01-22 23:33:47 -05:00
parent 2f4e0d9e17
commit 57c1983e07
13 changed files with 717 additions and 607 deletions

View File

@@ -27,9 +27,8 @@
#include <algorithm>
#include <iostream>
#include <sstream>
#include "text.h"
#include "Tree.h"
#include <text.h>
#include <Tree.h>
////////////////////////////////////////////////////////////////////////////////
// - Tree, Branch and Node are synonymous.
@@ -118,6 +117,12 @@ int Tree::branches ()
return _branches.size ();
}
////////////////////////////////////////////////////////////////////////////////
void Tree::name (const std::string& name)
{
_name = name;
}
////////////////////////////////////////////////////////////////////////////////
std::string Tree::name () const
{
@@ -135,9 +140,14 @@ void Tree::attribute (const std::string& name, const std::string& value)
// Accessor for attributes.
void Tree::attribute (const std::string& name, const int value)
{
std::stringstream s;
s << value;
_attributes[name] = s.str ();
_attributes[name] = format (value);
}
////////////////////////////////////////////////////////////////////////////////
// Accessor for attributes.
void Tree::attribute (const std::string& name, const double value)
{
_attributes[name] = format (value, 1, 8);
}
////////////////////////////////////////////////////////////////////////////////