summaryrefslogtreecommitdiff
path: root/libc/src/stdio/scanf_core/string_reader.cpp
blob: 1d728d2b9eb35e630dd772f4b46b3ccc619b23db (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
//===-- String Reader implementation for scanf ------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/stdio/scanf_core/string_reader.h"
#include <stddef.h>

namespace __llvm_libc {
namespace scanf_core {

char StringReader::get_char() {
  char cur_char = string[cur_index];
  ++cur_index;
  return cur_char;
}

void StringReader::unget_char() { --cur_index; }

} // namespace scanf_core
} // namespace __llvm_libc