feisty meow concerns codebase  2.140
link_parser.cpp File Reference
Include dependency graph for link_parser.cpp:

Go to the source code of this file.

Macros

#define BASE_LOG(s)   program_wide_logger::get().log(s, ALWAYS_PRINT)
 
#define LOG(s)   CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)
 
#define INCREM_N_GO   { curr_index++; continue; }
 
#define ADD_INTERMEDIATE
 
#define JUMP_TO_CHAR(to_find, save_them)
 
#define NEXT_STATE_INCREM
 
#define CLEAN_UP_NAUGHTY(s)
 
#define MAKE_MORE_ENGLISH(s)    s.replace_all('_', ' ')
 
#define WRITE_LINK
 
#define WRITE_SECTION
 
#define RESET_STRINGS
 

Functions

char normalize_char (char a)
 
bool caseless_equals (char a, char b)
 
void strain_out_html_codes (astring &to_edit)
 

Variables

const int MAX_FILE_SIZE = 4 * MEGABYTE
 

Macro Definition Documentation

◆ ADD_INTERMEDIATE

#define ADD_INTERMEDIATE
Value:
{ \
char add_in = full_contents[curr_index]; \
if ( (add_in == '<') || (add_in == '>') ) { \
add_in = '-'; \
} \
intermediate_text += add_in; \
}

Definition at line 69 of file link_parser.cpp.

◆ BASE_LOG

#define BASE_LOG (   s)    program_wide_logger::get().log(s, ALWAYS_PRINT)

Definition at line 51 of file link_parser.cpp.

◆ CLEAN_UP_NAUGHTY

#define CLEAN_UP_NAUGHTY (   s)
Value:
{ \
while (s.replace("\n", " ")) {} \
while (s.replace("\r", "")) {} \
s.strip_spaces(); \
}

Definition at line 104 of file link_parser.cpp.

◆ INCREM_N_GO

#define INCREM_N_GO   { curr_index++; continue; }

Definition at line 66 of file link_parser.cpp.

◆ JUMP_TO_CHAR

#define JUMP_TO_CHAR (   to_find,
  save_them 
)
Value:
{ \
while ( (curr_index < full_contents.length()) \
&& !caseless_equals(to_find, full_contents[curr_index]) ) { \
if (save_them) ADD_INTERMEDIATE; \
curr_index++; \
} \
}

Definition at line 88 of file link_parser.cpp.

◆ LOG

#define LOG (   s)    CLASS_EMERGENCY_LOG(program_wide_logger::get(), s)

Definition at line 53 of file link_parser.cpp.

◆ MAKE_MORE_ENGLISH

#define MAKE_MORE_ENGLISH (   s)     s.replace_all('_', ' ')

Definition at line 126 of file link_parser.cpp.

◆ NEXT_STATE_INCREM

#define NEXT_STATE_INCREM
Value:
{ \
state = parsing_states(state+1); /* move forward in states. */ \
curr_index++; \
continue; \
}

Definition at line 97 of file link_parser.cpp.

◆ RESET_STRINGS

#define RESET_STRINGS
Value:
{ \
url_string = astring::empty_string(); \
name_string = astring::empty_string(); \
intermediate_text = astring::empty_string(); \
}

Definition at line 183 of file link_parser.cpp.

◆ WRITE_LINK

#define WRITE_LINK
Value:
{ \
/* clean naughty characters out of the names. */ \
CLEAN_UP_NAUGHTY(url_string); \
CLEAN_UP_NAUGHTY(name_string); \
/* output a link in the HOOPLE format. */ \
astring to_write = "\"L\",\""; \
to_write += translate_web_chars(name_string); \
to_write += "\",\""; \
to_write += abbreviate_category(last_heading); \
to_write += "\",\""; \
to_write += translate_web_chars(url_string); \
to_write += "\"\n"; \
output_file.write(to_write); \
_link_count++; \
}

Definition at line 142 of file link_parser.cpp.

◆ WRITE_SECTION

#define WRITE_SECTION
Value:
{ \
CLEAN_UP_NAUGHTY(last_heading); /* clean the name. */ \
/* output a category definition. */ \
astring to_write = "\"C\",\""; \
to_write += translate_web_chars(last_heading); \
to_write += "\",\""; \
to_write += abbreviate_category(last_parents.top()); \
to_write += "\"\n"; \
output_file.write(to_write); \
_category_count++; \
}

Definition at line 170 of file link_parser.cpp.

Function Documentation

◆ caseless_equals()

bool caseless_equals ( char  a,
char  b 
)

Definition at line 85 of file link_parser.cpp.

References normalize_char().

◆ normalize_char()

char normalize_char ( char  a)

Definition at line 78 of file link_parser.cpp.

Referenced by caseless_equals().

◆ strain_out_html_codes()

void strain_out_html_codes ( astring to_edit)

Variable Documentation

◆ MAX_FILE_SIZE

const int MAX_FILE_SIZE = 4 * MEGABYTE

Definition at line 60 of file link_parser.cpp.