这个项目的主要目标是实现MS标准的INI文件读写库,主要版本使用C++实现,然后考虑使用C#,Java等其他编程语言实现。

该项目的设计目标有:
1)超简单的API,只有4个主要API接口:ReadString,ReadInt32,WriteString,WriteInt32;
2)支持ANSI、UTF-8、Unicode等编码格式;
3)为了保证解析速度,支持文件缓存;

类图设计:
class TextFile:
      file:FILE;
      content:String;

enum CodeType:
      ANSI, UNICODE, UTF8,

class StringDecoder:
      Decode(org:String, to:CodeType):String;

class StringEncode:
      Encode(org:String, to:CodeType):String;

class IniField:
      map<String, String> keyvalues;

class IniFile:TextFile:
      vector<IniField> fields;

class IniFileCache:
      vector<IniFile> files;

APIs:
      ReadIniString(field:String, key:String, default:String, file:String):String;
      ReadIniInt32(field:String, key:String, default:Int32, file:String):Int32;
      WriteIniString(field:String, key:String, value:String, file:String):void;
      WriteIniInt32(field:String, key:String, value:Int32, file:String):void;

Last edited May 17, 2014 at 4:09 PM by LiangHuan, version 3