Skip to content

Commit 745f92b

Browse files
Merge branch 'develop' into rtti
2 parents 84a92c7 + 3c146c7 commit 745f92b

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

Source/buildbindingccpp.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ func buildDynamicCLoadTableCode(component ComponentDefinition, w LanguageWriter,
412412

413413
w.Writeln("#ifdef _WIN32")
414414
w.Writeln("// Convert filename to UTF16-string")
415-
w.Writeln("int nLength = (int)strlen(pLibraryFileName);")
415+
w.Writeln("int nLength = static_cast<int>(strnlen_s(pLibraryFileName, MAX_PATH));")
416416
w.Writeln("int nBufferSize = nLength * 2 + 2;")
417417
if (!useStrictC) {
418418
w.Writeln("std::vector<wchar_t> wsLibraryFileName(nBufferSize);")
@@ -966,7 +966,7 @@ func writeCPPInputVector(w LanguageWriter, NameSpace string, ClassIdentifier str
966966
w.Writeln(" ")
967967
w.Writeln("public:")
968968
w.Writeln(" ")
969-
w.Writeln(" C%sInputVector( const std::vector<T>& vec)", ClassIdentifier)
969+
w.Writeln(" explicit C%sInputVector( const std::vector<T>& vec)", ClassIdentifier)
970970
w.Writeln(" : m_data( vec.data() ), m_size( vec.size() )")
971971
w.Writeln(" {")
972972
w.Writeln(" }")
@@ -1281,7 +1281,7 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s
12811281
w.Writeln(" ")
12821282

12831283
if ExplicitLinking {
1284-
w.Writeln(" %s%sWrapper(void* pSymbolLookupMethod)", cppClassPrefix, ClassIdentifier)
1284+
w.Writeln(" explicit %s%sWrapper(void* pSymbolLookupMethod)", cppClassPrefix, ClassIdentifier)
12851285
w.Writeln(" {")
12861286
w.Writeln(" CheckError(nullptr, initWrapperTable(&m_WrapperTable));")
12871287
w.Writeln(" CheckError(nullptr, loadWrapperTableFromSymbolLookupMethod(&m_WrapperTable, pSymbolLookupMethod));")
@@ -1290,7 +1290,7 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s
12901290
w.Writeln(" }")
12911291
w.Writeln(" ")
12921292

1293-
w.Writeln(" %s%sWrapper(const std::string &sFileName)", cppClassPrefix, ClassIdentifier)
1293+
w.Writeln(" explicit %s%sWrapper(const std::string &sFileName)", cppClassPrefix, ClassIdentifier)
12941294
w.Writeln(" {")
12951295
w.Writeln(" CheckError(nullptr, initWrapperTable(&m_WrapperTable));")
12961296
w.Writeln(" CheckError(nullptr, loadWrapperTable(&m_WrapperTable, sFileName.c_str()));")

Source/componentdefinition.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,15 @@ type ComponentDefinitionEnumOption struct {
158158
XMLName xml.Name `xml:"option"`
159159
Name string `xml:"name,attr"`
160160
Value int `xml:"value,attr"`
161+
Description string `xml:"description,attr"`
161162
}
162163

163164
// ComponentDefinitionEnum definition of all enums used in the component's API
164165
type ComponentDefinitionEnum struct {
165166
ComponentDiffableElement
166167
XMLName xml.Name `xml:"enum"`
167168
Name string `xml:"name,attr"`
169+
Description string `xml:"description,attr"`
168170
Options []ComponentDefinitionEnumOption `xml:"option"`
169171
}
170172

Source/languagec.go

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ func buildSharedCCPPTypesHeader(component ComponentDefinition, w LanguageWriter,
140140
w.Writeln("#define %s_SUCCESS 0", strings.ToUpper (NameSpace));
141141
for i := 0; i < len(component.Errors.Errors); i++ {
142142
errorcode := component.Errors.Errors[i];
143-
w.Writeln("#define %s_ERROR_%s %d", strings.ToUpper (NameSpace), errorcode.Name, errorcode.Code);
143+
if (errorcode.Description != "") {
144+
w.Writeln("#define %s_ERROR_%s %d /** %s */", strings.ToUpper (NameSpace), errorcode.Name, errorcode.Code, errorcode.Description);
145+
} else {
146+
w.Writeln("#define %s_ERROR_%s %d", strings.ToUpper (NameSpace), errorcode.Name, errorcode.Code);
147+
}
144148
}
145149

146150
w.Writeln("");
@@ -511,8 +515,18 @@ func buildCCPPEnums(component ComponentDefinition, w LanguageWriter, NameSpace s
511515
for i := 0; i < len(component.Enums); i++ {
512516
enum := component.Enums[i];
513517
if (useCPPTypes) {
518+
if (enum.Description != "") {
519+
w.Writeln("/**");
520+
w.Writeln("* enum class e%s - %s", enum.Name, enum.Description);
521+
w.Writeln("*/");
522+
}
514523
w.Writeln("enum class e%s : %s_int32 {", enum.Name, NameSpace);
515524
} else {
525+
if (enum.Description != "") {
526+
w.Writeln("/**");
527+
w.Writeln("* enum e%s%s - %s", NameSpace, enum.Name, enum.Description);
528+
w.Writeln("*/");
529+
}
516530
w.Writeln("typedef enum e%s%s {", NameSpace, enum.Name);
517531
}
518532

@@ -523,9 +537,17 @@ func buildCCPPEnums(component ComponentDefinition, w LanguageWriter, NameSpace s
523537
}
524538
option := enum.Options[j];
525539
if (useCPPTypes) {
526-
w.Writeln(" %s = %d%s", option.Name, option.Value, comma);
540+
if (option.Description != "") {
541+
w.Writeln(" %s = %d%s /** %s */", option.Name, option.Value, comma, option.Description);
542+
} else {
543+
w.Writeln(" %s = %d%s", option.Name, option.Value, comma);
544+
}
527545
} else {
528-
w.Writeln(" e%s%s = %d%s", enum.Name, option.Name, option.Value, comma);
546+
if (option.Description != "") {
547+
w.Writeln(" e%s%s = %d%s /** %s */", enum.Name, option.Name, option.Value, comma, option.Description);
548+
} else {
549+
w.Writeln(" e%s%s = %d%s", enum.Name, option.Name, option.Value, comma);
550+
}
529551
}
530552
}
531553
if (useCPPTypes) {

0 commit comments

Comments
 (0)