Freeciv21
Develop your civilization from humble roots to a global empire
console.h File Reference
#include "support.h"
+ Include dependency graph for console.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_LEN_CONSOLE_LINE    1024
 
#define CON_RED   "\u001b[31m"
 
#define CON_GREEN   "\u001b[32m"
 
#define CON_YELLOW   "\u001b[33m"
 
#define CON_BLUE   "\u001b[34m"
 
#define CON_MAGENTA   "\u001b[35m"
 
#define CON_CYAN   "\u001b[36m"
 
#define CON_WHITE   "\u001b[37m"
 
#define CON_RESET   "\u001b[0m"
 

Enumerations

enum  rfc_status {
  C_COMMENT = 0 , C_VERSION = 1 , C_DEBUG = 2 , C_LOG_BASE = 10 ,
  C_OK = 100 , C_DISCONNECTED = 102 , C_FAIL = 200 , C_METAERROR = 201 ,
  C_SYNTAX = 300 , C_BOUNCE = 301 , C_GENFAIL = 400 , C_WARNING = 500
}
 

Functions

void con_set_color (const char *)
 
void con_log_init (const QString &log_filename)
 Initialize logging via console. More...
 
void con_log_close ()
 Deinitialize logging. More...
 
void con_write (enum rfc_status rfc_status, const char *message,...) fc__attribute((__format__(__printf__
 
void void con_puts (enum rfc_status rfc_status, const char *str)
 Write to console and add line-break, and show prompt if required. More...
 
void con_flush ()
 Ensure timely update. More...
 
void con_prompt_init ()
 Initialize prompt; display initial message. More...
 
void con_prompt_off ()
 Do not print a prompt after log messages. More...
 
void con_prompt_enter ()
 User pressed enter: will need a new prompt. More...
 
void con_set_style (bool i)
 Set style. More...
 
bool con_get_style ()
 Returns rfc-style. More...
 

Macro Definition Documentation

◆ CON_BLUE

#define CON_BLUE   "\u001b[34m"

Definition at line 54 of file console.h.

◆ CON_CYAN

#define CON_CYAN   "\u001b[36m"

Definition at line 56 of file console.h.

◆ CON_GREEN

#define CON_GREEN   "\u001b[32m"

Definition at line 52 of file console.h.

◆ CON_MAGENTA

#define CON_MAGENTA   "\u001b[35m"

Definition at line 55 of file console.h.

◆ CON_RED

#define CON_RED   "\u001b[31m"

Definition at line 51 of file console.h.

◆ CON_RESET

#define CON_RESET   "\u001b[0m"

Definition at line 58 of file console.h.

◆ CON_WHITE

#define CON_WHITE   "\u001b[37m"

Definition at line 57 of file console.h.

◆ CON_YELLOW

#define CON_YELLOW   "\u001b[33m"

Definition at line 53 of file console.h.

◆ MAX_LEN_CONSOLE_LINE

#define MAX_LEN_CONSOLE_LINE    1024

Definition at line 19 of file console.h.

Enumeration Type Documentation

◆ rfc_status

enum rfc_status
Enumerator
C_COMMENT 
C_VERSION 
C_DEBUG 
C_LOG_BASE 
C_OK 
C_DISCONNECTED 
C_FAIL 
C_METAERROR 
C_SYNTAX 
C_BOUNCE 
C_GENFAIL 
C_WARNING 

Definition at line 36 of file console.h.

Function Documentation

◆ con_flush()

void con_flush ( )

Ensure timely update.

Definition at line 183 of file console.cpp.

Referenced by metaserver_failed().

◆ con_get_style()

bool con_get_style ( )

Returns rfc-style.

Definition at line 201 of file console.cpp.

Referenced by handle_stdin_input_real(), show_help_command_list(), and show_help_option_list().

◆ con_log_close()

void con_log_close ( )

Deinitialize logging.

Definition at line 123 of file console.cpp.

Referenced by main(), and server_quit().

◆ con_log_init()

void con_log_init ( const QString &  log_filename)

Initialize logging via console.

Definition at line 111 of file console.cpp.

Referenced by main().

◆ con_prompt_enter()

void con_prompt_enter ( )

User pressed enter: will need a new prompt.

Definition at line 225 of file console.cpp.

◆ con_prompt_init()

void con_prompt_init ( )

Initialize prompt; display initial message.

Definition at line 206 of file console.cpp.

Referenced by freeciv::server::server().

◆ con_prompt_off()

void con_prompt_off ( )

Do not print a prompt after log messages.

Definition at line 220 of file console.cpp.

Referenced by freeciv::server::pulse().

◆ con_puts()

void void con_puts ( enum rfc_status  rfc_status,
const char *  str 
)

Write to console and add line-break, and show prompt if required.

Same as con_write, but without the format string stuff. The real reason for this is because attribute complained with con_write(C_COMMENT,"") of "warning: zero-length format string"; this allows con_puts(C_COMMENT,"");

Definition at line 162 of file console.cpp.

Referenced by con_prompt_init(), con_set_style(), con_write(), metaserver_failed(), and start_game().

◆ con_set_color()

void con_set_color ( const char *  col)

Definition at line 130 of file console.cpp.

Referenced by con_puts().

◆ con_set_style()

void con_set_style ( bool  i)

Set style.

Definition at line 188 of file console.cpp.

Referenced by handle_stdin_input_real().

◆ con_write()

void con_write ( enum rfc_status  rfc_status,
const char *  message,
  ... 
)