mirror of
https://github.com/ocornut/imgui.git
synced 2026-09-26 16:05:45 +03:00
ImGuiTextFilter: moved ImGuiTextFilterItem to internals. (#2435)
This commit is contained in:
parent
a0cdc046a7
commit
3bae66c735
3 changed files with 16 additions and 14 deletions
|
|
@ -3222,7 +3222,7 @@ void ImGuiTextFilter::Build()
|
|||
// FIXME-OPT: as items are derived from user input buffer and we expect the insert() to behave sanely.
|
||||
if (is_excl)
|
||||
{
|
||||
_Items.insert(_Items.Data + _CountExclude, ImGuiTextFilter::ImGuiTextFilterItem(word_b, word_e));
|
||||
_Items.insert(_Items.Data + _CountExclude, ImGuiTextFilterItem(word_b, word_e));
|
||||
_CountExclude++;
|
||||
if (seq_incl_start_idx != -1)
|
||||
seq_incl_start_idx++;
|
||||
|
|
@ -3231,7 +3231,7 @@ void ImGuiTextFilter::Build()
|
|||
{
|
||||
if (seq_incl_start_idx == -1)
|
||||
seq_incl_start_idx = _Items.Size;
|
||||
_Items.insert(_Items.Data + _Items.Size, ImGuiTextFilter::ImGuiTextFilterItem(word_b, word_e));
|
||||
_Items.insert(_Items.Data + _Items.Size, ImGuiTextFilterItem(word_b, word_e));
|
||||
_Items.Data[seq_incl_start_idx].CountInclude++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
imgui.h
16
imgui.h
|
|
@ -2920,6 +2920,7 @@ struct ImGuiOnceUponAFrame
|
|||
};
|
||||
|
||||
// Helper: Parse and apply text filters e.g. 'aaa bbb' (all), 'aaa,bbb' (any), '-aaa' (exclude), '"Hello, world"' (exact sequence)
|
||||
struct ImGuiTextFilterItem;
|
||||
struct ImGuiTextFilter
|
||||
{
|
||||
IMGUI_API ImGuiTextFilter(const char* default_filter = "");
|
||||
|
|
@ -2935,19 +2936,10 @@ struct ImGuiTextFilter
|
|||
inline bool Draw(const char* label, float width) { if (width != 0.0f) ImGui::SetNextItemWidth(width); return Draw(label); }
|
||||
#endif
|
||||
|
||||
// [Internal] Types
|
||||
struct ImGuiTextFilterItem
|
||||
{
|
||||
const char* Begin;
|
||||
int Len;
|
||||
int CountInclude; // >0 when beginning of an AND chain.
|
||||
ImGuiTextFilterItem(const char* b, const char* e) { IM_ASSERT(e > b); Begin = b; Len = (int)(e - b); CountInclude = 0; }
|
||||
};
|
||||
|
||||
// [Internal] Members
|
||||
// Members
|
||||
char InputBuf[256]; // User input buffer
|
||||
int _CountExclude; // >= 0 count of leading exclude
|
||||
ImVector<ImGuiTextFilterItem> _Items; // Pre-parsed, trimmed, reordered items
|
||||
int _CountExclude; // [Internal] >= 0 count of leading exclude
|
||||
ImVector<ImGuiTextFilterItem> _Items; // [Internal] Pre-parsed, trimmed, reordered items
|
||||
};
|
||||
|
||||
// Helper: Growable text buffer for logging/accumulating text
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit context pointer
|
|||
// - Helper: ImPool<>
|
||||
// - Helper: ImChunkStream<>
|
||||
// - Helper: ImGuiTextIndex
|
||||
// - Helper: ImGuiTextFilterItem
|
||||
// - Helper: ImGuiStorage
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -847,6 +848,15 @@ struct ImGuiTextIndex
|
|||
void append(const char* base, int old_size, int new_size);
|
||||
};
|
||||
|
||||
// [Internal] Types
|
||||
struct ImGuiTextFilterItem
|
||||
{
|
||||
const char* Begin;
|
||||
int Len;
|
||||
int CountInclude; // >0 when beginning of an AND chain.
|
||||
ImGuiTextFilterItem(const char* b, const char* e) { IM_ASSERT(e > b); Begin = b; Len = (int)(e - b); CountInclude = 0; }
|
||||
};
|
||||
|
||||
// Helper: ImGuiPackedDate (sizeof() == 2)
|
||||
// Store a date in a way that is efficient to read/write in text form. If we stored e.g. number of days since Epoch we'd need costlier back and forth.
|
||||
// This is specifically designed to be able to prune old .ini data.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue