Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 # include "tsconfig/TsValue.h"
00022 # include <stdio.h>
00023 # include <iostream>
00024 
00025 using ts::config::Configuration;
00026 using ts::config::Value;
00027 
00028 inline std::ostream& operator << ( std::ostream& s, ts::ConstBuffer const& b ) {
00029   if (b._ptr) s.write(b._ptr, b._size);
00030   else s << b._size;
00031   return s;
00032 }
00033 
00034 int main(int , char **) {
00035   printf("Testing TsConfig\n");
00036   ts::Rv<Configuration> cv = Configuration::loadFromPath("test-1.tsconfig");
00037   if (cv.isOK()) {
00038     Value v = cv.result().find("thing-1.name");
00039     if (v) {
00040       std::cout << "thing-1.name = " << v.getText() << std::endl;
00041     } else {
00042       std::cout << "Failed to find 'name' in 'thing-1'" << std::endl;
00043     }
00044   } else {
00045     std::cout << "Load failed" << std::endl
00046               << cv.errata()
00047       ;
00048   }
00049 }