aboutsummaryrefslogtreecommitdiff
path: root/libbutl/prompt.mxx
blob: 87bded20f8ac7e2b8cbd283b0aa41e15a09b627f (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
// file      : libbutl/prompt.mxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef __cpp_modules
#pragma once
#endif

// C includes.

#ifndef __cpp_lib_modules
#include <string>
#endif

// Other includes.

#ifdef __cpp_modules
export module butl.prompt;
#ifdef __cpp_lib_modules
import std.core;
#endif
#endif

#include <libbutl/export.hxx>

LIBBUTL_MODEXPORT namespace butl
{
  // The Y/N prompt. The def argument, if specified, should be either 'y' or
  // 'n'. It is used as the default answer, in case the user just hits enter.
  //
  // Write the prompt to diag_stream. Throw ios_base::failure if no answer
  // could be extracted from stdin (for example, because it was closed).
  //
  LIBBUTL_SYMEXPORT bool
  yn_prompt (const std::string&, char def = '\0');
}