w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rtools.hpp
Go to the documentation of this file.
1// $Id: Rtools.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-10-26 1059 1.0.7 add Catch2Cerr()
8// 2017-02-18 852 1.0.6 remove TimeOfDayAsDouble()
9// 2017-02-11 850 1.0.5 add Word2Bytes() and Bytes2Word()
10// 2014-11-23 606 1.0.4 add TimeOfDayAsDouble()
11// 2013-05-04 516 1.0.3 add CreateBackupFile(), String2Long()
12// 2013-02-13 481 1.0.2 remove ThrowLogic(), ThrowRuntime()
13// 2011-04-10 376 1.0.1 add ThrowLogic(), ThrowRuntime()
14// 2011-03-12 368 1.0 Initial version
15// ---------------------------------------------------------------------------
16
21#ifndef included_Retro_Rtools
22#define included_Retro_Rtools 1
23
24#include <cstdint>
25#include <string>
26#include <functional>
27
28#include "RerrMsg.hpp"
29#include "RparseUrl.hpp"
30
31namespace Retro {
32
33 struct RflagName {
34 uint32_t mask;
35 const char* name;
36 };
37
38 namespace Rtools {
39 std::string Flags2String(uint32_t flags, const RflagName* fnam,
40 char delim='|');
41
42 bool String2Long(const std::string& str, long& res,
43 RerrMsg& emsg, int base=10);
44 bool String2Long(const std::string& str, unsigned long& res,
45 RerrMsg& emsg, int base=10);
46
47 bool CreateBackupFile(const std::string& fname, size_t nbackup,
48 RerrMsg& emsg);
49 bool CreateBackupFile(const RparseUrl& purl, RerrMsg& emsg);
50
51 void Word2Bytes(uint16_t word, uint16_t& byte0, uint16_t& byte1);
52 uint16_t Bytes2Word(uint16_t byte0, uint16_t byte1);
53
54 void Catch2Cerr(const char* msg, std::function<void()> func);
55
56 } // end namespace Rtools
57
58} // end namespace Retro
59
60#include "Rtools.ipp"
61
62#endif
FIXME_docs.
Definition: RerrMsg.hpp:25
FIXME_docs.
Definition: RparseUrl.hpp:27
void Word2Bytes(uint16_t word, uint16_t &byte0, uint16_t &byte1)
FIXME_docs.
Definition: Rtools.ipp:20
std::string Flags2String(uint32_t flags, const RflagName *fnam, char delim)
FIXME_docs.
Definition: Rtools.cpp:48
bool String2Long(const std::string &str, long &res, RerrMsg &emsg, int base)
FIXME_docs.
Definition: Rtools.cpp:67
uint16_t Bytes2Word(uint16_t byte0, uint16_t byte1)
FIXME_docs.
Definition: Rtools.ipp:30
void Catch2Cerr(const char *msg, std::function< void()> func)
FIXME_docs.
Definition: Rtools.cpp:170
bool CreateBackupFile(const std::string &fname, size_t nbackup, RerrMsg &emsg)
FIXME_docs.
Definition: Rtools.cpp:98
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47
uint32_t mask
Definition: Rtools.hpp:34
const char * name
Definition: Rtools.hpp:35