aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/stringprintf.h
blob: 23ca2583ca58c5b61fb20b0bc42555a9a0d90b17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Printf variants that place their output in a C++ string.
//
// Usage:
//      string result = strings::Printf("%d %s\n", 10, "hello");
//      strings::SPrintf(&result, "%d %s\n", 10, "hello");
//      strings::Appendf(&result, "%d %s\n", 20, "there");

#ifndef TENSORFLOW_LIB_STRINGS_STRINGPRINTF_H_
#define TENSORFLOW_LIB_STRINGS_STRINGPRINTF_H_

#include <stdarg.h>
#include <string>
#include <vector>

#include "tensorflow/core/platform/port.h"

namespace tensorflow {
namespace strings {

// Return a C++ string
extern string Printf(const char* format, ...)
    // Tell the compiler to do printf format string checking.
    TF_PRINTF_ATTRIBUTE(1, 2);

// Append result to a supplied string
extern void Appendf(string* dst, const char* format, ...)
    // Tell the compiler to do printf format string checking.
    TF_PRINTF_ATTRIBUTE(2, 3);

// Lower-level routine that takes a va_list and appends to a specified
// string.  All other routines are just convenience wrappers around it.
extern void Appendv(string* dst, const char* format, va_list ap);

}  // namespace strings
}  // namespace tensorflow

#endif  // TENSORFLOW_LIB_STRINGS_STRINGPRINTF_H_