Skip to content

Commit 1d6b816

Browse files
author
Ivan Dlugos
committed
C++ generated code - use .obx.hpp and .obx.cpp extensions
1 parent 49c3174 commit 1d6b816

File tree

12 files changed

+13
-12
lines changed

12 files changed

+13
-12
lines changed

internal/generator/c/cgenerator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (gen *CGenerator) BindingFiles(forFile string, options generator.Options) [
4848
if gen.PlainC {
4949
return []string{base + ".obx.h"}
5050
}
51-
return []string{base + "-cpp.obx.h", base + ".obx.cpp"}
51+
return []string{base + ".obx.hpp", base + ".obx.cpp"}
5252
}
5353

5454
// ModelFile returns the model GO file for the given JSON info file path
@@ -64,6 +64,7 @@ func (CGenerator) IsGeneratedFile(file string) bool {
6464
var name = filepath.Base(file)
6565
return name == "objectbox-model.h" ||
6666
strings.HasSuffix(name, ".obx.h") ||
67+
strings.HasSuffix(name, ".obx.hpp") ||
6768
strings.HasSuffix(name, ".obx.cpp")
6869
}
6970

test/comparison/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ objectbox-model.[ch]
44

55
*.obx.go
66
*.obx.[ch]
7-
*.obx.cpp
7+
*.obx.[ch]pp

test/comparison/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Therefore, the test works as follows:
1414
* negative tests: if the file has a fail infix in the name: `*.fail.<source-type>`,
1515
it's considered a negative test case (the generation should fail)
1616
* `<source-type>/<test-case>/<target-type>/*.<target-type-ext>.expected` are files expected to be generated
17-
e.g. `fbs/typeful/cpp/schema-cpp.obx.h`
17+
e.g. `fbs/typeful/cpp/schema.obx.hpp`
1818
* there's an exception with `go` source & target type = the target type isn't present in the path
1919
e.g. `go/typeful/typebuf.obx.go.expected`
2020
* `<source-type>/<test-case>/objectbox-model.json.expected` is the expected model JSON file, it's common for all languages.

test/comparison/conf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ type testSpec struct {
5353

5454
var confs = map[string]testSpec{
5555
"fbs-c": {"c", ".fbs", []string{".obx.h"}, &cgenerator.CGenerator{PlainC: true}, &cTestHelper{cpp: false}},
56-
"fbs-cpp": {"cpp", ".fbs", []string{"-cpp.obx.h", ".obx.cpp"}, &cgenerator.CGenerator{PlainC: false}, &cTestHelper{cpp: true}},
56+
"fbs-cpp": {"cpp", ".fbs", []string{".obx.hpp", ".obx.cpp"}, &cgenerator.CGenerator{PlainC: false}, &cTestHelper{cpp: true}},
5757
"go": {"go", ".go", []string{".obx.go"}, &gogenerator.GoGenerator{}, &goTestHelper{}},
5858
}

test/comparison/testdata/fbs/typeful/cpp/schema.obx.cpp.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Code generated by ObjectBox; DO NOT EDIT.
22

3-
#include "schema-cpp.obx.h"
3+
#include "schema.obx.hpp"
44

55
const obx::Property<Typeful, OBXPropertyType_Long> Typeful_::id(1);
66
const obx::Property<Typeful, OBXPropertyType_Int> Typeful_::int_(2);

test/comparison/testdata/fbs/typeful/cpp/schema-cpp.obx.h.expected renamed to test/comparison/testdata/fbs/typeful/cpp/schema.obx.hpp.expected

File renamed without changes.

test/integration/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CMakeLists.txt
33
objectbox-model.json
44
objectbox-model.[ch]
55
*.obx.[ch]
6-
*.obx.cpp
6+
*.obx.[ch]pp
77

88
# IDE
99
.idea/

test/integration/property-clear/cpp/step-1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "catch2/catch.hpp"
44
#include "objectbox-cpp.h"
5-
#include "schema-cpp.obx.h"
5+
#include "schema.obx.hpp"
66
#include "shared/store-init.h"
77
using namespace obx;
88

test/integration/property-clear/cpp/step-2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "catch2/catch.hpp"
44
#include "objectbox-cpp.h"
5-
#include "schema-cpp.obx.h"
5+
#include "schema.obx.hpp"
66
#include "shared/store-init.h"
77
using namespace obx;
88

test/integration/renames/cpp/step-1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "catch2/catch.hpp"
44
#include "objectbox-cpp.h"
5-
#include "schema-cpp.obx.h"
5+
#include "schema.obx.hpp"
66
#include "shared/store-init.h"
77
using namespace obx;
88

0 commit comments

Comments
 (0)