2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* OpenOffice.org 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 Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:06:55 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-16 23:49:11 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_tools.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <stdlib.h>
|
2001-02-13 08:39:28 +00:00
|
|
|
#include <stdio.h>
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-06-27 21:07:06 +00:00
|
|
|
#include <tools/stream.hxx>
|
2011-08-29 23:03:08 +01:00
|
|
|
#include <comphelper/string.hxx>
|
2006-06-19 12:21:34 +00:00
|
|
|
#include "bootstrp/prj.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-05-21 17:00:45 +03:00
|
|
|
#if defined(WNT)
|
2000-09-18 16:07:07 +00:00
|
|
|
#define LIST_DELIMETER ';'
|
|
|
|
#define PATH_DELIMETER '\\'
|
2006-06-19 12:21:34 +00:00
|
|
|
#elif defined UNX
|
|
|
|
#define LIST_DELIMETER ':'
|
2000-09-18 16:07:07 +00:00
|
|
|
#define PATH_DELIMETER '/'
|
|
|
|
#endif
|
|
|
|
|
2011-06-14 12:23:42 +01:00
|
|
|
SimpleConfig::SimpleConfig(const String &rSimpleConfigFileName)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-06-14 12:23:42 +01:00
|
|
|
aFileStream.Open(rSimpleConfigFileName, STREAM_READ);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SimpleConfig::~SimpleConfig()
|
|
|
|
{
|
|
|
|
aFileStream.Close ();
|
|
|
|
}
|
|
|
|
|
2011-06-21 23:04:05 +01:00
|
|
|
rtl::OString SimpleConfig::getNext()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-06-21 23:04:05 +01:00
|
|
|
if (aStringBuffer == "")
|
2008-10-10 13:02:43 +00:00
|
|
|
while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t"
|
2011-06-21 23:04:05 +01:00
|
|
|
if ( aStringBuffer == "" )
|
|
|
|
return rtl::OString();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-08-29 23:03:08 +01:00
|
|
|
rtl::OString aString = comphelper::string::getToken(aStringBuffer, 0, '\t');
|
2011-10-04 11:27:00 +03:00
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning (push)
|
|
|
|
#pragma warning (disable:4244)
|
|
|
|
#endif
|
|
|
|
aStringBuffer.Erase(0, aString.getLength()+1);
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning (pop)
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aStringBuffer.EraseLeadingChars( '\t' );
|
|
|
|
|
|
|
|
return aString;
|
|
|
|
}
|
|
|
|
|
2011-06-21 23:04:05 +01:00
|
|
|
rtl::OString SimpleConfig::GetNextLine()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-09-18 21:41:14 +01:00
|
|
|
rtl::OString aTmpStr;
|
|
|
|
aFileStream.ReadLine(aTmpStr);
|
|
|
|
if (aTmpStr[0] == '#')
|
2011-06-21 23:04:05 +01:00
|
|
|
return rtl::OString('\t');
|
2011-09-18 21:41:14 +01:00
|
|
|
return aTmpStr.trim().replace(' ', '\t');
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2011-06-14 12:07:00 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|