cinifileimpl.h

来自「一个用于跨操作系统平台的INI配置文件操作模块。」· C头文件 代码 · 共 85 行

H
85
字号
/*cinifileimpl.h*/
/*
*  Common Ini file
*
*  Copyright (c) 2003 xuyeli2002@vip.sina.com
*  History:
*  Author         Date
*  -------------------------------------------------
*  Yeli Xu        2003-01-24
*/

#ifndef __CINIFILEIMPL_H__
#define __CINIFILEIMPL_H__

#include <stdio.h>
#include <time.h>
#include <stdlib.h>

#include <cinidefs.h>


/**
 * class tm_CINI_IniFile_Impl
 */
class tm_CINI_IniFile_Impl
{
  private:
    char _filename[_MAX_PATH];


  public:
    //constructor and destructor
    tm_CINI_IniFile_Impl(const char *filename);
    ~tm_CINI_IniFile_Impl();
    

    //read and write functions
    tm_return readString(const char *section, const char *ident, 
        char *buffer, unsigned int *length);
    tm_return writeString(const char *section, const char *ident, 
        const char *valstring);
    
    tm_return readInt(const char *section, const char *ident, int *valint);
    tm_return writeInt(const char *section, const char *ident, int valint);
    
    tm_return readBool(const char *section, const char *ident, bool *valbool);
    tm_return writeBool(const char *section, const char *ident, bool valbool);
    
    tm_return readFloat(const char *section, const char *ident, 
        double *valdbl);
    tm_return writeFloat(const char *Section, const char *ident, 
        double valdbl);

    
    tm_return readSection(const char *section, char *strings, 
        unsigned int *length);
    tm_return readSections(char *strings, unsigned int *length);
    
    //mani functions
    tm_return eraseSection(const char *section);
    tm_return eraseKey(const char *section, const char *ident);
    
    //judge function
    tm_return sectionExists(const char *section);
    tm_return valueExists(const char *section, const char *ident);

    //switch file
    tm_return switchInifile(const char *filename);
    
    //get ini filename
    tm_return getInifile(char *filename, unsigned int *length);


  private:
    //disable default constructor
    tm_CINI_IniFile_Impl() {return;};
    
    //check if the filename is NULL;
    bool _isEmpty();

};

#endif /*__CINIFILEIMPL_H__*/

⌨️ 快捷键说明

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