Browse Source

prtotype: prefix libc99 usage with ::

heck-rework
heck 3 years ago
parent
commit
c25c114082
  1. 17
      test/test_nr1.cc

17
test/test_nr1.cc

@ -434,7 +434,7 @@ namespace pEp {
class TestStruct1 { class TestStruct1 {
public: public:
// Create a new instance // Create a new instance
TestStruct1(int i, Test_enum e, const std::string& str) TestStruct1(int i, ::Test_enum e, const std::string& str)
{ {
pEpLogClass("called"); pEpLogClass("called");
_c_struct_p = ::new_test_struct(0, ONE, nullptr); //dont use raw-setters _c_struct_p = ::new_test_struct(0, ONE, nullptr); //dont use raw-setters
@ -453,13 +453,13 @@ namespace pEp {
// Best to use this constructor, as the object is in a valid state when the wrapped // Best to use this constructor, as the object is in a valid state when the wrapped
// c_struct_pp is known // c_struct_pp is known
TestStruct1(bool is_owner, Test_struct1** c_struct_pp) TestStruct1(bool is_owner, ::Test_struct1** c_struct_pp)
{ {
pEpLogClass("called"); pEpLogClass("called");
bind(is_owner, c_struct_pp); bind(is_owner, c_struct_pp);
} }
void bind(bool is_owner, Test_struct1** c_struct_pp) void bind(bool is_owner, ::Test_struct1** c_struct_pp)
{ {
if (c_struct_pp == nullptr) { if (c_struct_pp == nullptr) {
throw Exception{ EXSTR("cant bind on a nullptr") }; throw Exception{ EXSTR("cant bind on a nullptr") };
@ -508,7 +508,7 @@ namespace pEp {
} }
pEp::POD<int> c_int{}; pEp::POD<int> c_int{};
pEp::POD<Test_enum> c_enum{}; pEp::POD<::Test_enum> c_enum{};
pEp::String c_str{}; pEp::String c_str{};
static bool log_enabled; static bool log_enabled;
@ -553,10 +553,10 @@ int main()
// value types are being copied around (stack) // value types are being copied around (stack)
static_assert(std::is_pod<int>::value && !std::is_pointer<int>::value, "not an integral"); static_assert(std::is_pod<int>::value && !std::is_pointer<int>::value, "not an integral");
static_assert( static_assert(
std::is_pod<Test_enum>::value && !std::is_pointer<Test_enum>::value, std::is_pod<::Test_enum>::value && !std::is_pointer<::Test_enum>::value,
"not an integral"); "not an integral");
static_assert( static_assert(
std::is_pod<Test_struct1>::value && !std::is_pointer<Test_struct1>::value, std::is_pod<::Test_struct1>::value && !std::is_pointer<::Test_struct1>::value,
"not an integral"); "not an integral");
// pEp::Utils::readKey(); // pEp::Utils::readKey();
@ -656,6 +656,7 @@ int main()
} }
} }
// Struct
if (0) { if (0) {
// create // create
{ {
@ -664,7 +665,7 @@ int main()
pEpLog(pstruct1.c_enum); pEpLog(pstruct1.c_enum);
pEpLog(pstruct1.c_str); pEpLog(pstruct1.c_str);
Test_struct1* c_struct1 = pstruct1; ::Test_struct1* c_struct1 = pstruct1;
pEpLog(c_struct1->c_int); pEpLog(c_struct1->c_int);
pEpLog(c_struct1->c_enum); pEpLog(c_struct1->c_enum);
pEpLog(c_struct1->c_str); pEpLog(c_struct1->c_str);
@ -673,7 +674,7 @@ int main()
// wrap // wrap
{ {
Test_struct1* c_struct1 = new_test_struct(0, ONE, "pEp"); ::Test_struct1* c_struct1 = new_test_struct(0, ONE, "pEp");
pEpLog(c_struct1->c_int); pEpLog(c_struct1->c_int);
pEpLog(c_struct1->c_enum); pEpLog(c_struct1->c_enum);
pEpLog(c_struct1->c_str); pEpLog(c_struct1->c_str);

Loading…
Cancel
Save