Blender V5.0
text_format.cc File Reference
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_path_utils.hh"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_string_utils.hh"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "ED_text.hh"
#include "text_format.hh"

Go to the source code of this file.

Functions

static void flatten_string_append (FlattenString *fs, const char *c, int accum, int len)
int flatten_string (const SpaceText *st, FlattenString *fs, const char *in)
void flatten_string_free (FlattenString *fs)
int flatten_string_strlen (FlattenString *fs, const char *str)
int text_check_format_len (TextLine *line, uint len)
void text_format_fill (const char **str_p, char **fmt_p, const char type, const int len)
void text_format_fill_ascii (const char **str_p, char **fmt_p, const char type, const int len)
void ED_text_format_register (TextFormatType *tft)
TextFormatTypeED_text_format_get (Text *text)
const char * ED_text_format_comment_line_prefix (Text *text)
bool ED_text_is_syntax_highlight_supported (Text *text)
int text_format_string_literal_find (const Span< const char * > string_literals, const char *text)
bool text_format_string_literals_check_sorted_array (const Span< const char * > string_literals)

Variables

static ListBase tft_lb = {nullptr, nullptr}

Function Documentation

◆ ED_text_format_comment_line_prefix()

const char * ED_text_format_comment_line_prefix ( Text * text)

Definition at line 204 of file text_format.cc.

References ED_text_format_get().

Referenced by text_comment_exec().

◆ ED_text_format_get()

TextFormatType * ED_text_format_get ( Text * text)

◆ ED_text_format_register()

◆ ED_text_is_syntax_highlight_supported()

bool ED_text_is_syntax_highlight_supported ( Text * text)

◆ flatten_string()

◆ flatten_string_append()

void flatten_string_append ( FlattenString * fs,
const char * c,
int accum,
int len )
static

◆ flatten_string_free()

◆ flatten_string_strlen()

int flatten_string_strlen ( FlattenString * fs,
const char * str )

Takes a string within fs->buf and returns its length.

Definition at line 103 of file text_format.cc.

References BLI_assert, FlattenString::buf, len, FlattenString::pos, and str.

◆ text_check_format_len()

int text_check_format_len ( TextLine * line,
unsigned int len )

Ensures the format string for the given line is long enough, reallocating as needed. Allocation is done here, alone, to ensure consistency.

Definition at line 110 of file text_format.cc.

References TextLine::format, len, MEM_freeN(), and MEM_malloc_arrayN().

Referenced by txtfmt_glsl_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), and txtfmt_py_format_line().

◆ text_format_fill()

void text_format_fill ( const char ** str_p,
char ** fmt_p,
char type,
int len )

Fill the string with formatting constant, advancing str_p and fmt_p

Parameters
lenlength in bytes of fmt_p to fill.

Definition at line 131 of file text_format.cc.

References BLI_assert, BLI_str_utf8_size_safe(), i, len, size(), and str.

Referenced by txtfmt_glsl_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), and txtfmt_py_format_line().

◆ text_format_fill_ascii()

void text_format_fill_ascii ( const char ** str_p,
char ** fmt_p,
char type,
int len )

ASCII version of text_format_fill, use when we no the text being stepped over is ASCII (as is the case for most keywords)

Definition at line 153 of file text_format.cc.

References BLI_assert, len, and str.

Referenced by txtfmt_glsl_format_line(), txtfmt_osl_format_line(), txtfmt_pov_format_line(), txtfmt_pov_ini_format_line(), and txtfmt_py_format_line().

◆ text_format_string_literal_find()

◆ text_format_string_literals_check_sorted_array()

bool text_format_string_literals_check_sorted_array ( const Span< const char * > string_literals)

Variable Documentation

◆ tft_lb