ReactOS  0.4.15-dev-1070-ge1a01de
utils.cpp File Reference
#include <string>
#include <algorithm>
#include <stdexcept>
#include <unistd.h>
#include <stdlib.h>
Include dependency graph for utils.cpp:

Go to the source code of this file.

Functions

string to_upper (string s)
 
string real_path (const char *path)
 
string replace_backslashes (string s)
 

Function Documentation

◆ real_path()

string real_path ( const char path)

Definition at line 43 of file utils.cpp.

44 {
45  char* temp = NULL;
46  #if defined(_WIN32)
47  char temp2[MAX_PATH];
48  if (GetFullPathNameA(path, MAX_PATH, temp2, NULL)) {
49  temp = temp2;
50  }
51  #else
52  temp = realpath(path, NULL);
53  #endif
54  if (temp == NULL)
55  throw runtime_error("realpath failed");
56  string result(temp);
57  #if !defined(_WIN32)
58  free(temp);
59  #endif
60  return result;
61 }
#define free
Definition: debug_ros.c:5
DWORD WINAPI GetFullPathNameA(IN LPCSTR lpFileName, IN DWORD nBufferLength, OUT LPSTR lpBuffer, OUT LPSTR *lpFilePart)
Definition: path.c:992
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:34
static calc_node_t temp
Definition: rpn_ieee.c:38
GLuint64EXT * result
Definition: glext.h:11304

Referenced by hhp_reader::compute_unique_file_pathes_set(), and main().

◆ replace_backslashes()

string replace_backslashes ( string  s)

Definition at line 63 of file utils.cpp.

64 {
65  string temp = s;
66  for (string::iterator it = temp.begin(); it != temp.end(); ++it)
67  if (*it == '\\')
68  *it = '/';
69  return temp;
70 }
GLdouble s
Definition: gl.h:2039
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by hhp_reader::compute_unique_file_pathes_set(), and main().

◆ to_upper()

string to_upper ( string  s)

Definition at line 36 of file utils.cpp.

37 {
38  string temp = s;
39  transform(temp.begin(), temp.end(), temp.begin(), ::toupper);
40  return temp;
41 }
int toupper(int c)
Definition: utclib.c:881
GLdouble s
Definition: gl.h:2039
static calc_node_t temp
Definition: rpn_ieee.c:38
GLuint GLenum GLenum transform
Definition: glext.h:9407

Referenced by hhp_key_value_section::add_entry(), hhp_reader::add_section(), hhp_key_value_section::process_line(), and hhp_reader::read().