test_rebuild.cpp 867 字节
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
/***************************************************************************
 * 
 * Copyright (c) 2008 Baidu.com, Inc. All Rights Reserved
 * $Id: test_rebuild.cpp,v 1.3 2009/02/13 15:25:31 yingxiang Exp $ 
 * 
 **************************************************************************/
 
 
 
/**
 * @file test_rebuild.cpp
 * @author yingxiang(com@baidu.com)
 * @date 2008/12/29 21:29:18
 * @version $Revision: 1.3 $ 
 * @brief i
 *  
 **/

#include "Configure.h"

int main(){
	comcfg :: Configure conf;
	conf.load(".", "rebuild.conf");
	printf("key: %d\n", conf["all"]["xxx"]["key"].to_int32());
	size_t sz;
	char * s = conf.dump(&sz);
	comcfg :: Configure cf2;
	char * buf = cf2.getRebuildBuffer(sz);
	memcpy(buf, s, sz);
	cf2.rebuild();
	printf("key: %d\n", cf2["all"]["xxx"]["key"].to_int32());
	return 0;
}
















/* vim: set ts=4 sw=4 sts=4 tw=100 */