LLOOP Index | GSP Language | GSP Library | Framework Classes | Component Classes

IniFile.h

This is the verbatim text of the file "IniFile.h" part of the LLOOP package. The copyright remains with Michel MEHL. All rights reserved.


#include "universal__String.h"

namespace ini {
  class Parser;
  class SectionList;
  class SIniFile;
};

/**
 *  IniFile Class. 
 * 
 *  It is assumed that ini files are not likely to contain large amount of 
 *  data, in which case this may not be the most efficient implementation, as
 *  data are searched iteratively to get their value.
 *  For very large amount of data, "map" objects could be created (see
 *  <map> of STL library) to access directly to the DataList and SectionList
 *  objects. These map object would be initialized in the constructor 
 *  and accesses using the [] operator would replace the 'while' loops.
 */

class UNIVERSAL_DLL IniFile 
{
private: 

  ini::Parser *  m_pParser;      // Parser
  ini::SIniFile* m_pSIniFile;    // Parsed IniFile object
  universal::String    m_sFilename;    // Full file path

public:
  
  IniFile(const universal::String& c_sFilename, bool bCreate = false) ;
  virtual ~IniFile() ;

  universal::String filename() const;
  ini::SIniFile* data() const;
  bool fail() const;

  void getError(std::ostream& os) const;
  universal::String& get(const universal::String& c_sSectionName, const universal::String& c_sDataName) const;
  universal::String& get(unsigned long uIndex) const;
  bool insert(const universal::String& c_sSectionName, const universal::String& c_sDataName, const universal::String& s_sDataValue);
  bool save(const universal::String& c_sFilename = "") const;

protected:

  ini::SectionList& getSection(const universal::String& c_sSectionName) const;
} ;
#endif

This file is part of the LLOOP Reversible Object-Oriented Parser Generator. Copyright (c) 2005-2006 Michel MEHL, France. All rights reserved. LLOOP is distributed by the company ERSA SaRL.


Copyright (c) 2005-2006 Michel MEHL, Haguenau, France
LLOOP version 1.1