Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File API #90

Open
heinezen opened this issue Mar 29, 2021 · 2 comments
Open

File API #90

heinezen opened this issue Mar 29, 2021 · 2 comments
Labels
c++ involves C++ code good first issue Simple thing, suitable for newcomers nice new thing ☺ adds new functionality

Comments

@heinezen
Copy link
Member

nyan should provide a file api that we can inherit from.

Then we can natively interface to the openage file abstraction and do not need to read the whole file in the engine. Basically a class nyan::Filesystem that is specialized by openage. Ideally, the returned file lazily accesses all data through openage::util::File.

@heinezen heinezen added nice new thing ☺ adds new functionality c++ involves C++ code good first issue Simple thing, suitable for newcomers labels Mar 29, 2021
@DavidRomanovizc
Copy link

and in what place should this be done?

@TheJJ
Copy link
Member

TheJJ commented Oct 21, 2021

Currently you pass a function to the Database initialization (db.load(), the filefetcher_t), which is passed to read files. When this is implemented, nyan would get passed an object of abstract type that provides file opening/reading features. This abstract type is then made concrete in openage by implementing it (i.e. a subclass) that calls to openage's filesystem abstraction features (but that doesn't concern this issue directly of course, since we only need to provide an api class).
If we just want to replace the filefetcher_t for now, the simplest variant is:

class nyan::Filesystem {
public:
    virtual nyan::File open_file(const std::string &filename) = 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ involves C++ code good first issue Simple thing, suitable for newcomers nice new thing ☺ adds new functionality
Projects
None yet
Development

No branches or pull requests

3 participants