| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/ccpro/ccproparser.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "ccproparser.h"cxx . . $ `<file>/src/core/ccpro/ccproparser.h`/ |
| 5 | |
| 6 | #include "zipdatasink.h"cxx . . $ `<file>/src/core/ccpro/zipdatasink.h`/ |
| 7 | #include "zipdatasource.h"cxx . . $ `<file>/src/core/ccpro/zipdatasource.h`/ |
| 8 | #include <exception> |
| 9 | #include <spdlog/spdlog.h> |
| 10 | |
| 11 | stdcxx . . $ std/::stringcxx . . $ std/string# CCPROParsercxx . . $ CCPROParser#::fileExtensioncxx . . $ CCPROParser#fileExtension(219584694fe2b248).() const |
| 12 | { |
| 13 | return "ccpro"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 14 | } |
| 15 | |
| 16 | stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<char>> |
| 17 | CCPROParsercxx . . $ CCPROParser#::loadcxx . . $ CCPROParser#load(4a2d2be9eefdc507).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path, |
| 18 | stdcxx . . $ std/::stringcxx . . $ std/string# const &internalDataName) |
| 19 | { |
| 20 | ZipDataSourcecxx . . $ ZipDataSource# dataSourcecxx . . $ ZipDataSource#ZipDataSource(769d1bd79eb25b11).(path); |
| 21 | |
| 22 | if (!internalDataName.emptycxx . . $ std/__cxx11/basic_string#empty(3482b152b9333168).()) { |
| 23 | try { |
| 24 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<char> fileDatacxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 25 | if (dataSource.readcxx . . $ ZipDataSource#read(6cf0d5dcdcb5ad06).(internalDataName, fileData)) |
| 26 | return {cxx . . $ std/optional#optional(e3f0d6382bd52f24).fileData}; |
| 27 | } |
| 28 | catch (stdcxx . . $ std/::exception const &e) { |
| 29 | SPDLOG_DEBUGcxx . . $ `<external>/13613935168682455490/spdlog.h:311:13`!(e.what()); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | return {cxx . . $ std/optional#optional(ced63f7c635d850d).}; |
| 34 | } |
| 35 | |
| 36 | bool CCPROParsercxx . . $ CCPROParser#::savecxx . . $ CCPROParser#save(fa1fcfc7541085fc).( |
| 37 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path, |
| 38 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::vectorcxx . . $ std/vector#<char>>> const &data) |
| 39 | { |
| 40 | ZipDataSinkcxx . . $ ZipDataSink# dataSinkcxx . . $ ZipDataSink#ZipDataSink(769d1bd79eb25b11).(path); |
| 41 | |
| 42 | try { |
| 43 | return dataSink.writecxx . . $ ZipDataSink#write(4b2265c2a260e669).(data); |
| 44 | } |
| 45 | catch (stdcxx . . $ std/::exception const &e) { |
| 46 | SPDLOG_DEBUGcxx . . $ `<external>/13613935168682455490/spdlog.h:311:13`!(e.what()); |
| 47 | } |
| 48 | |
| 49 | return false; |
| 50 | } |