* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
*\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
*\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
*\r
******************************************************************/\r
\r
+/**\r
+ * @file IncludeResolver.h\r
+ *\r
+ * @brief This file provides APIs for resolving included files.\r
+ */\r
+\r
#ifndef INCLUDE_RESOLVER_H\r
#define INCLUDE_RESOLVER_H\r
\r
-#include "yaml-cpp/yaml.h"\r
-#include "cJSON.h"\r
-#include "Utils.h"\r
#include <fstream>\r
+#include <algorithm>\r
+#if defined (__TIZENRT__)\r
+#include <apps/netutils/cJSON.h>\r
+#else\r
+#include "cJSON.h"\r
+#endif\r
+#include "yaml-cpp/yaml.h"\r
#include "yaml-cpp/exceptions.h"\r
+#include "RamlUtils.h"\r
+#include "RamlExceptions.h"\r
\r
namespace RAML\r
{\r
+ /**\r
+ * @class IncludeResolver\r
+ * @brief This class provides a set of APIs for resolving included files.\r
+ */\r
class IncludeResolver\r
{\r
-\r
public:\r
+ /** FileType - enumeration for Included File types*/\r
enum class FileType\r
{\r
NODE, JSON, FILE, NOTAG , ERROR\r
};\r
\r
-\r
public:\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse it to\r
+ * getting the created RootNode from RAML file.\r
+ *\r
+ * @param yamlFile - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return pointer to root node from the Parsed file.\r
+ */\r
YAML::Node readToYamlNode(const YAML::Node &yamlFile );\r
+\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse the specified Json file.\r
+ *\r
+ * @param jsonFile - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return cJSON pointer to CJson object.\r
+ */\r
cJSON *readToJson(const YAML::Node &jsonFile );\r
+\r
+ /**\r
+ * This method is for reading a file specified in YamlNode and parse the content of file.\r
+ *\r
+ * @param file - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return contents of the file.\r
+ */\r
std::string readFromFile(const YAML::Node &file );\r
+\r
+ /**\r
+ * This method is checking the file type specified in YamlNode.\r
+ *\r
+ * @param yamlNode - Reference to YamlNode specifying the FileName.\r
+ *\r
+ * @return FileType type of file.\r
+ */\r
FileType getFileType(const YAML::Node &yamlNode );\r
\r
+ /**\r
+ * This method is for reading a file specified and parse the content of file.\r
+ *\r
+ * @param jsonFileName - FileName of Json file to be read.\r
+ *\r
+ * @return pointer to CJson object.\r
+ */\r
+ cJSON *readToJson(const std::string &jsonFileName);\r
+\r
+ /**\r
+ * Constructor of IncludeResolver.\r
+ */\r
IncludeResolver() {}\r
- IncludeResolver(std::string &path) : m_path(path) {}\r
+\r
+ /**\r
+ * Constructor of IncludeResolver.\r
+ *\r
+ * @param path - configuration file path.\r
+ *\r
+ */\r
+ IncludeResolver(const std::string &path) : m_path(path) {}\r
+\r
private:\r
std::string m_path;\r
};\r
\r
+ /** IncludeResolverPtr - shared Ptr to IncludeResolver.*/\r
+ typedef std::shared_ptr<IncludeResolver> IncludeResolverPtr;\r
+\r
}\r
#endif\r