Line data Source code
1 : /////////////////////////////////////////////////////////////////////////////
2 : // Name: libmei.h
3 : // Author: Laurent Pugin
4 : // Created: 2023
5 : // Copyright (c) Authors and others. All rights reserved.
6 : /////////////////////////////////////////////////////////////////////////////
7 :
8 : #ifndef __LIBMEI_H__
9 : #define __LIBMEI_H__
10 :
11 : #include "meiconverter.h"
12 :
13 : #include "framework/global/types/string.h"
14 :
15 : #define DEFINITION_FACTOR 1
16 :
17 : namespace libmei {
18 : #define STRING_FORMAT_MAX_LEN 2048
19 :
20 : /**
21 : * Implement the namespace level libmei function.
22 : */
23 :
24 0 : inline void LogWarning(const char* fmt, ...)
25 : {
26 0 : std::string str(STRING_FORMAT_MAX_LEN, 0);
27 : va_list args;
28 0 : va_start(args, fmt);
29 0 : vsnprintf(&str[0], STRING_FORMAT_MAX_LEN, fmt, args);
30 0 : va_end(args);
31 0 : str.resize(strlen(str.data()));
32 0 : mu::iex::mei::Convert::logs.push_back(muse::String::fromStdString(str));
33 0 : }
34 :
35 : /**
36 : * Implement the namespace level libmei function.
37 : */
38 :
39 3968 : inline std::string StringFormat(const char* fmt, ...)
40 : {
41 3968 : std::string str(STRING_FORMAT_MAX_LEN, 0);
42 : va_list args;
43 3968 : va_start(args, fmt);
44 3968 : vsnprintf(&str[0], STRING_FORMAT_MAX_LEN, fmt, args);
45 3968 : va_end(args);
46 3968 : str.resize(strlen(str.data()));
47 3968 : return str;
48 0 : }
49 : } // namespace
50 :
51 : #endif
|