ScopedNamespaceGuard Struct Reference

#include <dds_generator.h>

Collaboration diagram for ScopedNamespaceGuard:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ScopedNamespaceGuard (UTL_ScopedName *name, std::ostream &os, const char *keyword="namespace")
 ~ScopedNamespaceGuard ()

Public Attributes

std::ostream & os_
std::string semi_
int n_

Detailed Description

Definition at line 151 of file dds_generator.h.


Constructor & Destructor Documentation

ScopedNamespaceGuard::ScopedNamespaceGuard ( UTL_ScopedName *  name,
std::ostream &  os,
const char *  keyword = "namespace" 
) [inline]

Definition at line 152 of file dds_generator.h.

References n_, and semi_.

00154     : os_(os)
00155   {
00156     for (n_ = 0; name->tail();
00157          name = static_cast<UTL_ScopedName*>(name->tail())) {
00158       const char* str = name->head()->get_string();
00159       if (str && str[0]) {
00160         ++n_;
00161         os << keyword << (name->head()->escaped() ? " _" : " ")
00162            << str << " {\n";
00163       }
00164     }
00165     if (std::strcmp(keyword, "module") == 0) semi_ = ";";
00166   }

ScopedNamespaceGuard::~ScopedNamespaceGuard (  )  [inline]

Definition at line 168 of file dds_generator.h.

References n_, os_, and semi_.

00169   {
00170     for (int i = 0; i < n_; ++i) os_ << '}' << semi_ << '\n';
00171   }


Member Data Documentation

int ScopedNamespaceGuard::n_

Definition at line 175 of file dds_generator.h.

Referenced by ScopedNamespaceGuard(), and ~ScopedNamespaceGuard().

std::ostream& ScopedNamespaceGuard::os_

Definition at line 173 of file dds_generator.h.

Referenced by ~ScopedNamespaceGuard().

std::string ScopedNamespaceGuard::semi_

Definition at line 174 of file dds_generator.h.

Referenced by ScopedNamespaceGuard(), and ~ScopedNamespaceGuard().


The documentation for this struct was generated from the following file:
Generated on Fri Feb 12 20:05:58 2016 for OpenDDS by  doxygen 1.4.7