CBuild
C++ build system with scripts written in c++
Loading...
Searching...
No Matches
Namespaces | Functions
files.hpp File Reference

File parsing api. More...

#include "string"

Go to the source code of this file.

Namespaces

namespace  CBuild
 Filebuffer for CBuild ecosystem.
 
namespace  CBuild::fs
 

Functions

int CBuild::fs::replace (std::string file, std::string token, std::string data)
 Replace [token] by [data] in [file].
 
int CBuild::fs::set_var (std::string file, std::string var_type, std::string var_name, std::string data)
 Set value of variable with type var_type wth name var_name to data This function loocks for variable like this: <var_type> <var_name>, then it gets all before <var_type> and saves it to variable. Then it gets all after first ; and saves it to variable or if we do define, simply skips this part, (so be careful with including something after define, or after replacing multiline define). Then it reconstruct variable part to <var_type> <var_name> = <date> or #define <var_name> <date> if we do define (var_name == define or #define). Then it reconstruct line from prefix, variable and postfix and writes it to file.
 
std::string CBuild::fs::path_to_file (std::string in)
 Convert path to filename by replacing '\' by '.'.
 

Detailed Description

File parsing api.

Author
WolodiaM (w_mel.nosp@m.nyk@.nosp@m.outlo.nosp@m.ok.c.nosp@m.om)
Version
1.0
Date
2023-01-23

@license GPL v3.0 or later

Copyright (C) 2022 WolodiaM This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Definition in file files.hpp.