Switch to unified view

a/src/upmpdutils.hxx b/src/upmpdutils.hxx
...
...
22
#include <string>                       // for string
22
#include <string>                       // for string
23
#include <unordered_map>                // for unordered_map
23
#include <unordered_map>                // for unordered_map
24
#include <vector>                       // for vector
24
#include <vector>                       // for vector
25
25
26
class UpSong;
26
class UpSong;
27
28
/**
29
 * Read file into string.
30
 * @return true for ok, false else
31
 */
32
extern bool file_to_string(const std::string &filename, std::string &data, 
33
                           std::string *reason = 0);
34
35
extern void path_catslash(std::string &s);
36
extern bool path_exists(const std::string& path);
37
extern bool path_isabsolute(const std::string &path);
38
extern std::string path_cat(const std::string &s1, const std::string &s2);
39
extern void trimstring(std::string &s, const char *ws = " \t");
40
extern std::string path_tildexpand(const std::string &s);
41
extern void stringToTokens(const std::string &s, std::vector<std::string> &tokens,
42
             const std::string &delims = " \t", bool skipinit=true);
43
template <class T> bool stringToStrings(const std::string& s, T &tokens, 
44
                  const std::string& addseps = "");
45
extern bool path_makepath(const std::string& path, int mode);
46
27
47
// Convert between db value to percent values (Get/Set Volume and VolumeDb)
28
// Convert between db value to percent values (Get/Set Volume and VolumeDb)
48
extern int percentodbvalue(int value);
29
extern int percentodbvalue(int value);
49
extern int dbvaluetopercent(int dbvalue);
30
extern int dbvaluetopercent(int dbvalue);
50
31
...
...
72
// "newer" entries for diffing
53
// "newer" entries for diffing
73
extern std::unordered_map<std::string, std::string> 
54
extern std::unordered_map<std::string, std::string> 
74
diffmaps(const std::unordered_map<std::string, std::string>& old,
55
diffmaps(const std::unordered_map<std::string, std::string>& old,
75
         const std::unordered_map<std::string, std::string>& newer);
56
         const std::unordered_map<std::string, std::string>& newer);
76
57
77
/// Lock/pid file class. From Recoll
78
class Pidfile {
79
public:
80
    Pidfile(const std::string& path)  : m_path(path), m_fd(-1) {}
81
    ~Pidfile();
82
    /// Open/create the pid file.
83
    /// @return 0 if ok, > 0 for pid of existing process, -1 for other error.
84
    pid_t open();
85
    /// Write pid into the pid file
86
    /// @return 0 ok, -1 error
87
    int write_pid();
88
    /// Close the pid file (unlocks)
89
    int close();
90
    /// Delete the pid file
91
    int remove();
92
    const std::string& getreason() {return m_reason;}
93
private:
94
    std::string m_path;
95
    int    m_fd;
96
    std::string m_reason;
97
    pid_t read_pid();
98
    int flopen();
99
};
100
101
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */
58
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */