itl_generator.cpp File Reference

#include "itl_generator.h"
#include "be_extern.h"
#include "utl_identifier.h"
#include "utl_labellist.h"

Include dependency graph for itl_generator.cpp:

Go to the source code of this file.

Classes

struct  InlineType

Functions

std::ostream & operator<< (std::ostream &out, const itl_generator::Indent &i)
std::ostream & operator<< (std::ostream &out, const itl_generator::Open &i)
std::ostream & operator<< (std::ostream &out, const itl_generator::Close &i)
std::ostream & operator<< (std::ostream &out, const InlineType &it)


Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const InlineType it 
)

Definition at line 49 of file itl_generator.cpp.

References be_global, AstTypeClassification::CL_PRIMITIVE, AstTypeClassification::CL_STRING, AstTypeClassification::CL_WIDE, AstTypeClassification::classify(), BE_GlobalData::itl_, and InlineType::type.

00051 {
00052   AST_Typedef* td = AST_Typedef::narrow_from_decl(it.type);
00053   if (td) {
00054     be_global->itl_ << '"' << it.type->repoID() << '"';
00055     return out;
00056   }
00057 
00058   Classification c = classify(it.type);
00059   if (c & CL_STRING) {
00060     // TODO:  Support bounded strings.
00061     if (c & CL_WIDE) {
00062       be_global->itl_ << "{ \"kind\" : \"string\", \"note\" : { \"idl\" : { \"type\" : \"wstring\" } } }";
00063     }
00064     else {
00065       be_global->itl_ << "{ \"kind\" : \"string\" }";
00066     }
00067   }
00068   else if (c & CL_PRIMITIVE) {
00069     switch (AST_PredefinedType::narrow_from_decl(it.type)->pt()) {
00070     case AST_PredefinedType::PT_long:
00071       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 32 }";
00072       break;
00073     case AST_PredefinedType::PT_ulong:
00074       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 32, \"unsigned\" : true}";
00075       break;
00076     case AST_PredefinedType::PT_longlong:
00077       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 64 }";
00078       break;
00079     case AST_PredefinedType::PT_ulonglong:
00080       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 64, \"unsigned\" : true}";
00081       break;
00082     case AST_PredefinedType::PT_short:
00083       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 16 }";
00084       break;
00085     case AST_PredefinedType::PT_ushort:
00086       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 16, \"unsigned\" : true}";
00087       break;
00088     case AST_PredefinedType::PT_float:
00089       be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary32\" }";
00090       break;
00091     case AST_PredefinedType::PT_double:
00092       be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary64\" }";
00093       break;
00094     case AST_PredefinedType::PT_longdouble:
00095       be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary128\" }";
00096       break;
00097     case AST_PredefinedType::PT_char:
00098       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 8, \"note\" : { \"presentation\" : { \"type\" : \"char\" } } }";
00099       break;
00100     case AST_PredefinedType::PT_wchar:
00101       be_global->itl_ << "{ \"kind\" : \"int\", \"note\" : { \"presentation\" : { \"type\" : \"char\" }, \"idl\" : { \"type\" : \"wchar\" } } }";
00102       break;
00103     case AST_PredefinedType::PT_boolean:
00104       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 1, \"note\" : { \"presentation\" : { \"type\" : \"bool\" } } }";
00105       break;
00106     case AST_PredefinedType::PT_octet:
00107       be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 8, \"unsigned\" : true }";
00108       break;
00109     case AST_PredefinedType::PT_any:
00110     case AST_PredefinedType::PT_object:
00111     case AST_PredefinedType::PT_value:
00112     case AST_PredefinedType::PT_abstract:
00113     case AST_PredefinedType::PT_void:
00114     case AST_PredefinedType::PT_pseudo:
00115       // TODO
00116       break;
00117     }
00118   }
00119   else {
00120     be_global->itl_ << '"' << it.type->repoID() << '"';
00121   }
00122 
00123   return out;
00124 }

std::ostream& operator<< ( std::ostream &  out,
const itl_generator::Close i 
)

Definition at line 33 of file itl_generator.cpp.

References itl_generator::Close::generator, and itl_generator::level_.

00035 {
00036   i.generator->level_ -= 1;
00037   return out;
00038 }

std::ostream& operator<< ( std::ostream &  out,
const itl_generator::Open i 
)

Definition at line 25 of file itl_generator.cpp.

References itl_generator::Open::generator, and itl_generator::level_.

00027 {
00028   i.generator->level_ += 1;
00029   return out;
00030 }

std::ostream& operator<< ( std::ostream &  out,
const itl_generator::Indent i 
)

Definition at line 17 of file itl_generator.cpp.

References itl_generator::Indent::generator, and itl_generator::level_.

00019 {
00020   out << std::string(static_cast<size_t> (i.generator->level_ * 2), ' ');
00021   return out;
00022 }


Generated on Fri Feb 12 20:05:36 2016 for OpenDDS by  doxygen 1.4.7