< prev index next >

src/jdk.jpackage/share/native/libapplauncher/IniFile.cpp

Print this page




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "IniFile.h"
  27 #include "Helpers.h"
  28 
  29 #include <string>
  30 
  31 
  32 IniFile::IniFile() : ISectionalPropertyContainer() {
  33 }
  34 
  35 IniFile::~IniFile() {
  36     for (OrderedMap<TString, IniSectionData*>::iterator iterator =
  37             FMap.begin(); iterator != FMap.end(); iterator++) {
  38         pair<TString, IniSectionData*> *item = *iterator;
  39         delete item->second;
  40     }
  41 }
  42 
  43 bool IniFile::LoadFromFile(const TString FileName) {
  44     bool result = false;
  45     Platform& platform = Platform::GetInstance();
  46 
  47     std::list<TString> contents = platform.LoadFromFile(FileName);
  48 
  49     if (contents.empty() == false) {
  50         bool found = false;
  51 
  52         // Determine the if file is an INI file or property file.
  53         // Assign FDefaultSection if it is
  54         // an INI file. Otherwise FDefaultSection is NULL.
  55         for (std::list<TString>::const_iterator iterator = contents.begin();
  56                 iterator != contents.end(); iterator++) {
  57             TString line = *iterator;
  58 




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "IniFile.h"
  27 #include "Helpers.h"
  28 
  29 #include <string>
  30 
  31 
  32 IniFile::IniFile() : ISectionalPropertyContainer() {
  33 }
  34 
  35 IniFile::~IniFile() {
  36     for (OrderedMap<TString, IniSectionData*>::iterator iterator =
  37             FMap.begin(); iterator != FMap.end(); iterator++) {
  38         JPPair<TString, IniSectionData*> *item = *iterator;
  39         delete item->second;
  40     }
  41 }
  42 
  43 bool IniFile::LoadFromFile(const TString FileName) {
  44     bool result = false;
  45     Platform& platform = Platform::GetInstance();
  46 
  47     std::list<TString> contents = platform.LoadFromFile(FileName);
  48 
  49     if (contents.empty() == false) {
  50         bool found = false;
  51 
  52         // Determine the if file is an INI file or property file.
  53         // Assign FDefaultSection if it is
  54         // an INI file. Otherwise FDefaultSection is NULL.
  55         for (std::list<TString>::const_iterator iterator = contents.begin();
  56                 iterator != contents.end(); iterator++) {
  57             TString line = *iterator;
  58 


< prev index next >