File: string_util.cc

package info (click to toggle)
cmph 2.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,748 kB
  • sloc: ansic: 10,582; cpp: 2,429; makefile: 151; sh: 111; python: 48; xml: 5
file content (23 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "string_util.h"

#include <cassert>
#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

namespace cxxmph {

bool stream_printf(
    const std::string& format_string, uint32_t offset, std::ostream* out) {
  if (offset == format_string.length()) return true;
  assert(offset < format_string.length());
  cerr << "length:" << format_string.length() << endl;
  cerr << "offset:" << offset << endl;
  auto txt = format_string.substr(offset, format_string.length() - offset);
  *out << txt;
  return true;
}

}  // namespace cxxmph