/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 *
 * The iWear Framework 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 as in version 2 of the License.

 * 
 * The iWear Framework 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
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __IWEAR_INILOADER_H
#define __IWEAR_INILOADER_H

#ifndef __IWEAR_CONFIGLOADER_H
#include <iwear/configloader.h>
#endif

#include <string>


#include "iwear/cstdint.h"
using std::string;

namespace iwear
{

/**
 *
 */
class IniLoader : public ConfigLoader
{
private:
protected:
    string the_path;
    string path_comment;
    string fbase;
    void parse_value(const string& line, string& name, string& value, string& comment, string::size_type& spos, uint32_t linenr );
    void parse_line( const string& fnam, const string& line, string& path, string& name, string& value, string& comment, uint32_t linenr);
    void parse_include( const string&, const string&, uint32_t, uint32_t );
    void parse_comment( const string& line, string& comment, string::size_type& spos, uint32_t linenr);
    void parse_path( const string& line, string& path, string& comment, string::size_type& spos, uint32_t linenr );
    void parse_path_component( const string& line, string& path, string::size_type& spos, uint32_t linenr );

    void skip_whitespace( const string& line, string::size_type& spos );

    void load( const string& );
    virtual void reload( const string& );
public:
    IniLoader( const string& fn, Configuration& c ) : ConfigLoader(c), fbase(fn) { }
    virtual ~IniLoader();
    virtual void load( void );
    virtual void reload( void );
};

}
#endif

