Skip to content

Commit 96bb3de

Browse files
authored
Move TypeSpec::string and c_str from symtab.cpp to typespec.cpp (#756)
1 parent db18399 commit 96bb3de

2 files changed

Lines changed: 34 additions & 34 deletions

File tree

src/liboslcomp/symtab.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,6 @@ OSL_NAMESPACE_ENTER
4141
namespace pvt { // OSL::pvt
4242

4343

44-
std::string
45-
TypeSpec::string () const
46-
{
47-
std::string str;
48-
if (is_closure() || is_closure_array()) {
49-
str += "closure color";
50-
if (is_unsized_array())
51-
str += "[]";
52-
else if (arraylength() > 0)
53-
str += Strutil::format ("[%d]", arraylength());
54-
}
55-
else if (structure() > 0) {
56-
str += Strutil::format ("struct %d", structure());
57-
if (is_unsized_array())
58-
str += "[]";
59-
else if (arraylength() > 0)
60-
str += Strutil::format ("[%d]", arraylength());
61-
} else {
62-
str += simpletype().c_str();
63-
}
64-
return str;
65-
}
66-
67-
68-
69-
const char *
70-
TypeSpec::c_str () const
71-
{
72-
ustring s (this->string());
73-
return s.c_str ();
74-
}
75-
76-
77-
7844
std::string
7945
Symbol::mangled () const
8046
{

src/liboslexec/typespec.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,40 @@ TypeSpec::TypeSpec (const char *name, int structid, int arraylen)
6464

6565

6666

67+
std::string
68+
TypeSpec::string () const
69+
{
70+
std::string str;
71+
if (is_closure() || is_closure_array()) {
72+
str += "closure color";
73+
if (is_unsized_array())
74+
str += "[]";
75+
else if (arraylength() > 0)
76+
str += Strutil::format ("[%d]", arraylength());
77+
}
78+
else if (structure() > 0) {
79+
str += Strutil::format ("struct %d", structure());
80+
if (is_unsized_array())
81+
str += "[]";
82+
else if (arraylength() > 0)
83+
str += Strutil::format ("[%d]", arraylength());
84+
} else {
85+
str += simpletype().c_str();
86+
}
87+
return str;
88+
}
89+
90+
91+
92+
const char *
93+
TypeSpec::c_str () const
94+
{
95+
ustring s (this->string());
96+
return s.c_str ();
97+
}
98+
99+
100+
67101
int
68102
TypeSpec::structure_id (const char *name, bool add)
69103
{

0 commit comments

Comments
 (0)