mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
c2eea8abba
* massive clang-format -style=LLVM * naming harmonization * adding commentary about sysinfoapi.h
33 lines
938 B
C++
33 lines
938 B
C++
#ifndef SIMDJSON_JSONIOUTIL_H
|
|
#define SIMDJSON_JSONIOUTIL_H
|
|
|
|
#include "simdjson/common_defs.h"
|
|
#include <exception>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
#include "simdjson/padded_string.h"
|
|
|
|
namespace simdjson {
|
|
|
|
// load a file in memory...
|
|
// get a corpus; pad out to cache line so we can always use SIMD
|
|
// throws exceptions in case of failure
|
|
// first element of the pair is a string (null terminated)
|
|
// whereas the second element is the length.
|
|
// caller is responsible to free (aligned_free((void*)result.data())))
|
|
//
|
|
// throws an exception if the file cannot be opened, use try/catch
|
|
// try {
|
|
// p = get_corpus(filename);
|
|
// } catch (const std::exception& e) {
|
|
// aligned_free((void*)p.data());
|
|
// std::cout << "Could not load the file " << filename << std::endl;
|
|
// }
|
|
padded_string get_corpus(const std::string &filename);
|
|
} // namespace simdjson
|
|
|
|
#endif
|