Skip to content

Commit

Permalink
Fix hidden overloaded virtual function
Browse files Browse the repository at this point in the history
'RemoteSchemaDocumentProvider::GetRemoteDocument' and
'SchemaDocumentProvider::GetRemoteDocument' hide the vitual function
'IGenericRemoteSchemaDocumentProvider::GetRemoteDocument'.

Add using statement to fix overloaded-virtual warnings.
  • Loading branch information
EstherWx committed Dec 11, 2023
1 parent f9d5341 commit 0483443
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions test/unittest/schematest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2155,6 +2155,7 @@ class RemoteSchemaDocumentProvider : public IGenericRemoteSchemaDocumentProvider
delete sd_[i];
}

using IGenericRemoteSchemaDocumentProvider<SchemaDocumentType>::GetRemoteDocument;
virtual const SchemaDocumentType* GetRemoteDocument(const char* uri, SizeType length) {
//printf("GetRemoteDocument : %s\n", uri);
for (size_t i = 0; i < kCount; i++)
Expand Down Expand Up @@ -2636,26 +2637,28 @@ TEST(SchemaValidator, Ref_internal_multiple_ids) {
CrtAllocator::Free(schema);
}

TEST(SchemaValidator, Ref_remote_issue1210) {
class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider {
SchemaDocument** collection;
class SchemaDocumentProvider : public IRemoteSchemaDocumentProvider {
SchemaDocument** collection;

// Dummy private copy constructor & assignment operator.
// Function bodies added so that they compile in MSVC 2019.
SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) {
}
SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) {
return *this;
}
// Dummy private copy constructor & assignment operator.
// Function bodies added so that they compile in MSVC 2019.
SchemaDocumentProvider(const SchemaDocumentProvider&) : collection(NULL) {
}
SchemaDocumentProvider& operator=(const SchemaDocumentProvider&) {
return *this;
}

public:
SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { }
virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) {
int i = 0;
while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i;
return collection[i];
}
};
public:
SchemaDocumentProvider(SchemaDocument** collection) : collection(collection) { }
using IGenericRemoteSchemaDocumentProvider::GetRemoteDocument;
virtual const SchemaDocument* GetRemoteDocument(const char* uri, SizeType length) {
int i = 0;
while (collection[i] && SchemaDocument::GValue(uri, length) != collection[i]->GetURI()) ++i;
return collection[i];
}
};

TEST(SchemaValidator, Ref_remote_issue1210) {
SchemaDocument* collection[] = { 0, 0, 0 };
SchemaDocumentProvider provider(collection);

Expand Down

0 comments on commit 0483443

Please sign in to comment.