ConfigFile

Dependents:   ConfigFile_TestProgram StarBoardOrangeExpansion1 StarBoardOrangeExpansion2 Drive2ChoroQ ... more

Revision:
6:f6ceafabe9f8
Parent:
5:56d544b8e5c6
--- a/ConfigFile.cpp	Wed Sep 15 12:23:15 2010 +0000
+++ b/ConfigFile.cpp	Wed Sep 15 13:49:15 2010 +0000
@@ -10,6 +10,9 @@
 #define NEWLINE_DOS "\r\n"
 #define NEWLINE_MAC "\r"
 
+/**
+ * Create a configuration file class.
+ */
 ConfigFile::ConfigFile() {
     /*
      * Allocation for a config_t list.
@@ -20,6 +23,9 @@
     }
 }
 
+/**
+ * Destroy a configuration file class.
+ */
 ConfigFile::~ConfigFile() {
     /*
      * Remove all storage and the contents.
@@ -41,6 +47,14 @@
     configlist = NULL;
 }
 
+/**
+ * Get a value for a key.
+ *
+ * @param key A target key name.
+ * @param value A pointer to a value storage.
+ * @param siz A size of a value storage.
+ * @return A value or NULL.
+ */
 bool ConfigFile::getValue(char *key, char *value, size_t siz) {
     /*
      * Null check.
@@ -71,6 +85,14 @@
     return true;
 }
 
+/**
+ * Set a set of a key and value.
+ *
+ * @param key A key.
+ * @param value A value.
+ *
+ * @return True if it succeed.
+ */
 bool ConfigFile::setValue(char *key, char *value) {
     /*
      * Null check.
@@ -165,6 +187,13 @@
     }
 }
 
+/**
+ * Remove a config.
+ *
+ * @param key A key.
+ *
+ * @return True if it succeed.
+ */
 bool ConfigFile::remove(char *key) {
     if (key == NULL) {
         return false;
@@ -184,6 +213,11 @@
     return false;
 }
 
+/**
+ * Remove all config.
+ *
+ * @return True if it succeed.
+ */
 bool ConfigFile::removeAll(void) {
     for (int i = 0; i < MAXCONFIG; i++) {
         config_t *p = configlist[i];
@@ -197,6 +231,11 @@
     return true;
 }
 
+/**
+ * Get a number of configuration sets.
+ *
+ * @return number of configuration sets.
+ */
 int ConfigFile::getCount() {
     int cnt = 0;
     for (int i = 0; i < MAXCONFIG; i++) {
@@ -208,6 +247,17 @@
     return cnt;
 }
 
+/**
+ * Get a key and a value.
+ *
+ * @param index Index number of this list.
+ * @param key A pointer to a buffer for key.
+ * @param keybufsiz A size of the key buffer.
+ * @param value A pointer to a buffer for value.
+ * @param valuebufsiz A size of the value buffer.
+ *
+ * @return true if it succeed.
+ */
 bool ConfigFile::getKeyAndValue(int index, char *key, size_t keybufsiz, char *value, size_t valuebufsiz) {
     int cnt = 0;
     for (int i = 0; i < MAXCONFIG; i++) {
@@ -227,6 +277,11 @@
     return false;
 }
 
+/**
+ * Read from the target file.
+ *
+ * @param file A target file name.
+ */
 bool ConfigFile::read(char *file) {
     /*
      * Open the target file.
@@ -280,6 +335,13 @@
     return true;
 }
 
+/**
+ * Write from the target file.
+ *
+ * @param file A pointer to a file name.
+ * @param header A pointer to a header.
+ * @param ff File format.
+ */
 bool ConfigFile::write(char *file, char *header, FileFormat ff) {
     /*
      * Open the target file.