aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/base/testdocrepo.h
blob: ce8ae5fa741dbe8b0c711c8d6c36aa22d183f296 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/document/config/config-documenttypes.h>
#include <vespa/document/config/documenttypes_config_fwd.h>
#include <vespa/document/datatype/datatype.h>

namespace document {

class DocumentTypeRepo;

class TestDocRepo {
    DocumenttypesConfig _cfg;
    std::shared_ptr<const DocumentTypeRepo> _repo;

public:
    TestDocRepo();
    ~TestDocRepo();

    static DocumenttypesConfig getDefaultConfig();

    const DocumentTypeRepo& getTypeRepo() const { return *_repo; }
    std::shared_ptr<const DocumentTypeRepo> getTypeRepoSp() const { return _repo; }
    const DocumenttypesConfig& getTypeConfig() const { return _cfg; }
    const DataType* getDocumentType(const vespalib::string &name) const;
};

DocumenttypesConfig readDocumenttypesConfig(const char *file_name);
DocumenttypesConfig readDocumenttypesConfig(const std::string& file_name);

}  // namespace document