conf.h
来自「基于Linux下Epoll技术的EchoSvr」· C头文件 代码 · 共 71 行
H
71 行
/**
* \file conf.h
* \author Jason Armstrong <ja@riverdrums.com
* \version $Id: conf.h,v 1.2 2006/02/11 00:10:09 riverdrums Exp $
* \brief Header file for conf.c
*/
/*
COPYRIGHT (C) 2005 - 2006 RIVERDRUMS
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __RD_CONF_H__
#define __RD_CONF_H__
#include "def.h"
struct rdnameval {
char *name; /**< Name (key) */
char *value; /**< Value */
};
struct rdsection {
char * name; /**< Section Name */
struct rdnameval ** nv; /**< Name/value pairs */
int nvi; /**< Number of name/value pairs */
};
struct rdconf {
struct rdsection ** sect; /**< Sections eg [section_name] */
int secti; /**< Number of sections */
};
class Config
{
private:
char filename[256];
struct rdconf* configer;
private:
char* readLine(FILE *f, char **buf, int *s);
char *getValue(struct rdconf *c, char *section, char *name);
int addSection(struct rdconf *c,char *name);
int findSection(struct rdconf *c, char *name);
int addNameval(struct rdconf *c, int cs, char *name, char *val);
public:
Config(char*);
~Config();
bool read();
struct rdconf * RD__conf_read_section(char *file, char *section);
char *getValue(char *section, char *name);
int getInt(char *section, char *name);
void cleanup();
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?