FoofyFox Sandstorm 2
General-purpose Discord bot in C++
SSUtility.h
Go to the documentation of this file.
1#ifndef SSUTILITY_H_
2#define SSUTILITY_H_
3
11#include "SSGlobals.h"
12
14namespace std {}
15
17namespace dpp {}
18
20namespace ffss{
21class SSUtility {
22private:
23 SSUtility();
24 const static int discord_audio_encoding = mpg123_enc_enum::MPG123_ENC_SIGNED_16;
25 const static long discord_audio_bitrate = 48000l;
26
27 static inline void _cleanup_decoder(mpg123_handle * mh);
28 static inline void _check_decoder_status(mpg123_handle * mh, const int &status);
29public:
30 static size_t read_buf_size;
31 static std::string help_file;
32 static std::string fortune_file;
33 static size_t laugh_max;
34 static std::string default_img;
35 static std::string fenn_dir;
36 static size_t audio_queue_max;
37 static size_t args_max;
38 static char cmd_switch;
39
52 static std::vector<std::string> get_args(const std::string &raw_args);
68 static std::vector<std::string::size_type> calc_mindiff(std::vector<std::string> &v);
79 static std::string load_file(const std::string &path);
80
96 static std::vector<std::string> load_files(const std::string &path_root);
97
108 static std::vector<std::string> load_file_lines(const std::string &path);
109
118 static std::string load_pcm(const std::string &mp3_data);
119};
120}
121
122#endif /* SSUTILITY_H_ */
Global declarations for Sandstorm.
Definition: SSUtility.h:21
static size_t read_buf_size
Buffer size for read functions, specifically load_file()
Definition: SSUtility.h:30
static std::string help_file
Path of the help file for the 'help' command.
Definition: SSUtility.h:31
static std::vector< std::string > get_args(const std::string &raw_args)
Parse arguments.
Definition: SSUtility.cpp:66
static std::string load_pcm(const std::string &mp3_data)
Converts a MP3 file into PCM data.
Definition: SSUtility.cpp:225
static std::vector< std::string > load_files(const std::string &path_root)
Load a files from directory path_root.
Definition: SSUtility.cpp:155
static size_t args_max
Maximum number of arguments that can be processed from get_args.
Definition: SSUtility.h:37
static std::vector< std::string > load_file_lines(const std::string &path)
Load lines of a file into a vector of strings from path path.
Definition: SSUtility.cpp:181
static std::string default_img
Image to display if the user only enters the cmd_switch and no other characters.
Definition: SSUtility.h:34
static std::vector< std::string::size_type > calc_mindiff(std::vector< std::string > &v)
Calculate the minimum distinguishable length for each string in v.
Definition: SSUtility.cpp:25
static char cmd_switch
The command switch, say for '-vplay', the switch is '-'.
Definition: SSUtility.h:38
static std::string load_file(const std::string &path)
Load a file into a string with path path.
Definition: SSUtility.cpp:136
static std::string fenn_dir
Directory to look into for fennec fox images for the 'fennec' command.
Definition: SSUtility.h:35
static std::string fortune_file
Path for the different messages read by the 'fortuneteller' command.
Definition: SSUtility.h:32
static size_t audio_queue_max
Maximum size of the audio queue for the 'vplay' command.
Definition: SSUtility.h:36
static size_t laugh_max
Maximum length of 'HA's for 'A[HA]+' in the 'laugh' command.
Definition: SSUtility.h:33
libdpp namespace
Definition: SSUtility.h:17
FoofyFox Sandstorm (ffss) namespace.
Definition: SSMsgHandler.cpp:3
Standard namespace.
Definition: SSUtility.h:14