Skip to content

Commit

Permalink
Merge pull request #76 from jwillemsen/jwi-whitespace
Browse files Browse the repository at this point in the history
Removed redundant whitespaces
  • Loading branch information
jwillemsen committed Aug 30, 2024
2 parents 3b5c689 + 199de9d commit 4e81d93
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 104 deletions.
8 changes: 0 additions & 8 deletions XSC/be/CXX/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,6 @@ type_name (SemanticGraph::Instance& i, string const& nss)
}
else
{
//@@ I wonder if this is at all necessary now?
//

//if (!scope.empty ()) r += scope + L"::";

//r += fq_name (i.scope ());
//r += L"::";

r += id (i.name ());
}

Expand Down
42 changes: 21 additions & 21 deletions XSC/be/CXX/Header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << "using " << name << "_container_type = " << container << "< " << type << ">;";
os << "using " << name << "_container_type = " << container << "<" << type << ">;";
break;
}
switch(this->cppmode_)
Expand Down Expand Up @@ -237,7 +237,7 @@ namespace
os << "bool " << name << "_p () const;";
os << type << " const& " << id (name) << " () const;";
// os << type << "& " << id (name) << " ();"; // Lets just have one mutator
os << "void " << id (name) << " (" << type << " const& );";
os << "void " << id (name) << " (" << type << " const&);";

//Added for IDREF case
if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))
Expand All @@ -251,13 +251,13 @@ namespace
switch(this->cppmode_)
{
case CPPMODE::CPP03:
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_auto_ptr_type;";
os << id (name) << "_auto_ptr_type " << id (name) << "_;";
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_type;";
os << id (name) << "_type " << id (name) << "_;";
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;";
os << id (name) << "_unique_ptr_type " << id (name) << "_;";
os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;";
os << id (name) << "_type " << id (name) << "_;";
break;
}
}
Expand All @@ -267,7 +267,7 @@ namespace
//
os << type << " const& " << id (name) << " () const;";
// os << type << "& " << id (name) << " ();"; // Lets just have one mutator.
os << "void " << id (name) << " (" << type << " const& );";
os << "void " << id (name) << " (" << type << " const&);";

//Added for IDREF case
if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))
Expand All @@ -282,13 +282,13 @@ namespace
switch(this->cppmode_)
{
case CPPMODE::CPP03:
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_auto_ptr_type;";
os << id (name) << "_auto_ptr_type " << id (name) << "_;";
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_type;";
os << id (name) << "_type " << id (name) << "_;";
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;";
os << id (name) << "_unique_ptr_type " << id (name) << "_;";
os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;";
os << id (name) << "_type " << id (name) << "_;";
break;
}
}
Expand Down Expand Up @@ -339,7 +339,7 @@ namespace
os << "bool " << name << "_p () const;";
os << type << " const& " << id (name) << " () const;";
os << type << "& " << id (name) << " ();";
os << "void " << id (name) << " (" << type << " const& );";
os << "void " << id (name) << " (" << type << " const&);";

//Added for IDREF case
if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))
Expand All @@ -354,21 +354,21 @@ namespace
switch(this->cppmode_)
{
case CPPMODE::CPP03:
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_auto_ptr_type;";
os << id (name) << "_auto_ptr_type " << id (name) << "_;";
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_type;";
os << id (name) << "_type " << id (name) << "_;";
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;";
os << id (name) << "_unique_ptr_type " << id (name) << "_;";
os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;";
os << id (name) << "_type " << id (name) << "_;";
break;
}
}
else
{
os << type << " const& " << id (name) << " () const;";
os << type << "& " << id (name) << " ();";
os << "void " << id (name) << " (" << type << " const& );";
os << "void " << id (name) << " (" << type << " const&);";

//Added for IDREF case
if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))
Expand All @@ -383,13 +383,13 @@ namespace
switch(this->cppmode_)
{
case CPPMODE::CPP03:
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_auto_ptr_type;";
os << id (name) << "_auto_ptr_type " << id (name) << "_;";
os << "typedef XML_XSC_SMART_PTR( " << type << ") " << id (name) << "_type;";
os << id (name) << "_type " << id (name) << "_;";
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << "using " << id (name) << "_unique_ptr_type = std::unique_ptr< " << type << ">;";
os << id (name) << "_unique_ptr_type " << id (name) << "_;";
os << "using " << id (name) << "_type = std::unique_ptr<" << type << ">;";
os << id (name) << "_type " << id (name) << "_;";
break;
}
}
Expand Down
82 changes: 12 additions & 70 deletions XSC/be/CXX/Inline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ namespace
switch(this->cppmode_)
{
case CPPMODE::CPP03:
os << id (name) << "_ = " << scope << "::" << id(name) << "_auto_ptr_type (new " << type << " (e));"
os << id (name) << "_ = " << scope << "::" << id(name) << "_type (new " << type << " (e));"
<< id (name) << "_->container (this);";
break;
case CPPMODE::CPP11:
case CPPMODE::CPP17:
os << id (name) << "_ = std::make_unique< " << type << "> (e);";
os << id (name) << "_ = std::make_unique<" << type << "> (e);";
break;
}
os << "}"
Expand All @@ -145,14 +145,6 @@ namespace
<< "{"
<< "return *" << id (name) << "_;"
<< "}";
/* Lets just have one mutator
os << i
<< type << "& " << scope << "::" << endl
<< id (name) << " ()"
<< "{"
<< "return *" << id (name) << "_;"
<< "}";
*/
if ((idref_ptr != std::string::npos) && (this->cppmode_ == CPPMODE::CPP03))
{
os << i
Expand Down Expand Up @@ -275,7 +267,6 @@ namespace
os << "}";
}

// if (!this->cpp11_)
{
// count_typename
//
Expand Down Expand Up @@ -380,11 +371,11 @@ namespace

if (this->cppmode_ != CPPMODE::CPP03)
{
os << id (name) << "_ = std::make_unique< " << type << "> (e);";
os << id (name) << "_ = std::make_unique<" << type << "> (e);";
}
else
{
os << id (name) << "_ = " << scope << "::" << id(name) << "_auto_ptr_type (new " << type << " (e));"
os << id (name) << "_ = " << scope << "::" << id(name) << "_type (new " << type << " (e));"
<< id (name) << "_->container (this);";
}
os << "}"
Expand Down Expand Up @@ -460,12 +451,6 @@ namespace
names_.node_traverser (*this);
}

//virtual void
//traverse (SemanticGraph::Type& t)
//{
// os << comma () << type_name (t) << " const& b__";
//}

virtual void
traverse (SemanticGraph::Enumeration& e)
{
Expand Down Expand Up @@ -730,12 +715,6 @@ namespace
{
}

//virtual void
//traverse (SemanticGraph::Type&)
//{
// os << "Base (b__)," << endl;
//}

virtual void
traverse (SemanticGraph::Enumeration&)
{
Expand Down Expand Up @@ -859,7 +838,7 @@ namespace

if (this->cppmode_ != CPPMODE::CPP03)
{
os << ", " << name << "_ (std::make_unique< " << type << "> (" << name << "__))" << endl;
os << ", " << name << "_ (std::make_unique<" << type << "> (" << name << "__))" << endl;
}
else
{
Expand Down Expand Up @@ -891,7 +870,7 @@ namespace

if (this->cppmode_ != CPPMODE::CPP03)
{
os << ", " << name << "_ (std::make_unique< " << type << "> (" << name << "__))" << endl;
os << ", " << name << "_ (std::make_unique<" << type << "> (" << name << "__))" << endl;
}
else
{
Expand Down Expand Up @@ -988,7 +967,7 @@ namespace
{
os << ", " << name << "_ ("
<< "s." << name << "_ ? "
<< "std::make_unique< " << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl;
<< "std::make_unique<" << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl;
}
else
{
Expand All @@ -1003,7 +982,7 @@ namespace
//
if (this->cppmode_ != CPPMODE::CPP03)
{
os << ", " << name << "_ (std::make_unique< " << type << "> (*s." << name << "_))" << endl;
os << ", " << name << "_ (std::make_unique<" << type << "> (*s." << name << "_))" << endl;
}
else
{
Expand Down Expand Up @@ -1040,7 +1019,7 @@ namespace
{
os << ", " << name << "_ ("
<< "s." << name << "_ ? "
<< "std::make_unique< " << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl;
<< "std::make_unique<" << type << "> (*s." << name << "_) : " << nullptr_string << ")" << endl;
}
else
{
Expand All @@ -1053,7 +1032,7 @@ namespace
{
if (this->cppmode_ != CPPMODE::CPP03)
{
os << ", " << name << "_ (std::make_unique< " << type << "> (*s." << name << "_))" << endl;
os << ", " << name << "_ (std::make_unique<" << type << "> (*s." << name << "_))" << endl;
}
else
{
Expand Down Expand Up @@ -1101,22 +1080,6 @@ namespace
{
os << id (name) << "_->container (this);";
}
else
{
//string type (type_name (e));

//// sequence
////
//if (this->generate_ra_sequences_)
// os << name << "_.reserve (s." << name << "_.size ());";

//os << "{"
// << "for (" << name << "_const_iterator i (s."
// << name << "_.begin ());"
// << "i != s." << name << "_.end ();"
// << "++i) " << "add_" << name << " (*i);"
// << "}";
}
}

virtual void
Expand Down Expand Up @@ -1154,14 +1117,6 @@ namespace
{
}

//virtual void
//traverse (SemanticGraph::Type&)
//{
// os << "static_cast< Base& > (*this) = "
// << "static_cast< Base const& > (s);"
// << endl;
//}

virtual void
traverse (SemanticGraph::Element& e)
{
Expand All @@ -1179,7 +1134,7 @@ namespace
os << "if (s." << name << "_)" << std::endl
<< " " << name << " (*(s." << name << "_));"
<< "else" << std::endl
<< " " << name << "_.reset (nullptr);"
<< " " << name << "_.release ();"
<< endl;
}
else
Expand Down Expand Up @@ -1207,19 +1162,6 @@ namespace
//
os << id(name) << "_ = s." << id(name) << "_;"
<< std::endl;

//os << name << "_.clear ();";

//if (this->generate_ra_sequences_)
// os << name << "_.reserve (s." << name << "_.size ());";

//os << "{"
// << "for (" << name << "_const_iterator i (s."
// << name << "_.begin ());"
// << "i != s." << name << "_.end ();"
// << "++i) " << std::endl
// << "add_" << name << " (*i);"
// << "}";
}
}

Expand All @@ -1235,7 +1177,7 @@ namespace
{
os << "if (s." << name << "_) "
<< name << " (*(s." << name << "_));"
<< "else " << name << "_.reset (nullptr);"
<< "else " << name << "_.release ();"
<< endl;
}
else
Expand Down
6 changes: 3 additions & 3 deletions XSC/be/CXX/Source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ namespace
//
if (this->cppmode_ != CPPMODE::CPP03)
{
os << id (name) << "_ = std::make_unique< " << type << "> (e);";
os << id (name) << "_ = std::make_unique<" << type << "> (e);";
}
else
{
os << id (name) << "_ = " << scope << "::" << id(name) << "_auto_ptr_type (new " << type << " (e));"
os << id (name) << "_ = " << scope << "::" << id(name) << "_type (new " << type << " (e));"
<< id (name) << "_->container (this);";
}
}
Expand Down Expand Up @@ -231,7 +231,7 @@ namespace
}
else
{
os << id (name) << "_ = " << scope << "::" << id(name) << "_auto_ptr_type (new " << type << " (a));"
os << id (name) << "_ = " << scope << "::" << id(name) << "_type (new " << type << " (a));"
<< id (name) << "_->container (this);";
}
}
Expand Down
2 changes: 0 additions & 2 deletions XSCRT/XSCRT/Elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ namespace XSCRT
Type&
operator= (Type const&)
{
//@@ I don't need this.
//if (map_.get ()) map_->clear (); // Flush the map.
return *this;
}

Expand Down

0 comments on commit 4e81d93

Please sign in to comment.