Changeset 6520 for trunk/licq
- Timestamp:
- 09/13/08 22:58:45 (3 months ago)
- Location:
- trunk/licq
- Files:
-
- 2 modified
-
include/licq_file.h (modified) (2 diffs)
-
src/file.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/licq/include/licq_file.h
r6505 r6520 48 48 bool SetSection(const char *_szSectionName); 49 49 bool CreateSection(const char *_szSectionName); 50 51 /** 52 * Read a string value from the configuration file 53 * 54 * @param key Key of value to read 55 * @param data String to put value in 56 * @param defValue Default value to set if key doesn't exist 57 * @param trim True if leading and trailing white spaces should be trimmed 58 * @return True if value was found or false if default value was used 59 */ 60 bool readString(const std::string& key, std::string& data, 61 const std::string& defValue = "", bool trim = true); 62 50 63 bool ReadStr(const std::string& Key, char* data, const char* defValue = NULL, bool trim = true, int maxLength = 0); 51 64 bool ReadNum(const std::string& key, unsigned long &data, unsigned long defValue = 0); … … 57 70 bool ReadNum(const std::string& key, char &data, char defValue = 0); 58 71 bool ReadBool(const std::string& key, bool &data, const bool defValue = false); 72 73 /** 74 * Write a string value to the configuration file 75 * 76 * @param key Key of value to write 77 * @param data Value to write 78 */ 79 void writeString(const std::string& key, const std::string& data); 59 80 60 81 bool WriteStr(const std::string& key, const char* data); -
trunk/licq/src/file.cpp
r6504 r6520 654 654 } 655 655 656 bool CIniFile::readString(const string& key, string& data, 657 const string& defValue, bool trim) 658 { 659 char buffer[MAX_LINE_LEN]; 660 bool ret = ReadStr(key, buffer, defValue.c_str(), trim, MAX_LINE_LEN); 661 data = buffer; 662 return ret; 663 } 656 664 657 665 //-----ReadStr----------------------------------------------------------------- … … 686 694 return (true); 687 695 } 688 689 696 690 697 //-----ReadNum----------------------------------------------------------------- … … 794 801 } 795 802 803 void CIniFile::writeString(const std::string& key, const std::string& data) 804 { 805 WriteStr(key, data.c_str()); 806 } 796 807 797 808 //-----WriteStr----------------------------------------------------------------
