cfgmanage.h

来自「用STL模板库实现的配置文件读写库」· C头文件 代码 · 共 58 行

H
58
字号
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice-E is licensed to you under the terms described in the
// ICEE_LICENSE file included in this distribution.
//
// **********************************************************************

#ifndef CFGMANAGE_H
#define CFGMANAGE_H

#include <IceE/PropertiesF.h>
#include <IceE/Shared.h>
#include <IceE/Mutex.h>
#include <IceE/BuiltinSequences.h>

#include "cfgmanage.h"

namespace ETAH
{
typedef struct
{
	int lineNumber;
	std::string value;
}CfgItem;

class cfgManage : public IceUtil::Mutex, public ::IceUtil::Shared
{
public:
	cfgManage()
	{
	};
	std::string getProperty(const std::string&);
	std::string getPropertyWithDefault(const std::string&, const std::string&);
	Ice::Int getPropertyAsInt(const std::string&);
	Ice::Int getPropertyAsIntWithDefault(const std::string&, Ice::Int);
	void setProperty(const std::string&, const std::string&);
	void load(const std::string&);
	void save(void);
	int getModifyFlag(void);
	int getCheckSum(void);
	int calcChecksum(void);
private:
	std::string fileName;
	std::vector<std::string> fileBuffer;
	void parseLine(const std::string&, int lineNum);
	std::map<std::string, CfgItem> _properties;
	int modifyFlag;
	int chkSum;

	void insertProperty(const std::string&, const std::string&, int);
	void printFileBuffer(void);
};
} //end namespace

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?