#include "ts_generator.h"
#include "be_extern.h"
#include "utl_identifier.h"
#include "ace/OS_NS_sys_stat.h"
#include <cstring>
#include <fstream>
#include <sstream>
#include <map>
#include <iostream>
Include dependency graph for ts_generator.cpp:
Go to the source code of this file.
Namespaces | |
namespace | java_ts_generator |
namespace | face_ts_generator |
Functions | |
std::string | read_template (const char *prefix) |
void | replaceAll (std::string &s, const std::map< std::string, std::string > &rep) |
template<size_t N> | |
void | add_includes (const char *(&includes)[N], BE_GlobalData::stream_enum_t whichStream) |
void | java_ts_generator::generate (UTL_ScopedName *name) |
called directly by dds_visitor::visit_structure() if -Wb,java | |
void | face_ts_generator::generate (UTL_ScopedName *name) |
void @94::add_includes | ( | const char *& | includes[N], | |
BE_GlobalData::stream_enum_t | whichStream | |||
) | [static] |
Definition at line 52 of file ts_generator.cpp.
References BE_GlobalData::add_include(), and be_global.
Referenced by ts_generator::gen_struct().
00053 { 00054 for (size_t i = 0; i < N; ++i) { 00055 be_global->add_include(includes[i], whichStream); 00056 } 00057 }
std::string @94::read_template | ( | const char * | prefix | ) | [static] |
Definition at line 22 of file ts_generator.cpp.
References BE_abort().
00023 { 00024 const char* dds_root = ACE_OS::getenv("DDS_ROOT"); 00025 if (!dds_root) { 00026 ACE_DEBUG((LM_ERROR, "The environment variable DDS_ROOT must be set.\n")); 00027 BE_abort(); 00028 } 00029 std::string path = dds_root; 00030 path.append("/dds/idl/"); 00031 path.append(prefix); 00032 path.append("Template.txt"); 00033 std::ifstream ifs(path.c_str()); 00034 std::ostringstream oss; 00035 oss << ifs.rdbuf(); 00036 return oss.str(); 00037 }
void @94::replaceAll | ( | std::string & | s, | |
const std::map< std::string, std::string > & | rep | |||
) | [static] |
Definition at line 39 of file ts_generator.cpp.
Referenced by ts_generator::gen_struct().
00040 { 00041 typedef std::map<std::string, std::string>::const_iterator mapiter_t; 00042 for (size_t i = s.find("<%"); i < s.length(); i = s.find("<%", i + 1)) { 00043 size_t n = s.find("%>", i) - i + 2; 00044 mapiter_t iter = rep.find(s.substr(i + 2, n - 4)); 00045 if (iter != rep.end()) { 00046 s.replace(i, n, iter->second); 00047 } 00048 } 00049 }