MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / basicTextInputIntoArray

Function basicTextInputIntoArray

source/MRViewer/MRUIStyle.cpp:1853–1876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1851}
1852
1853static bool basicTextInputIntoArray( const char* label, char* array, std::size_t size, ImGuiInputTextFlags flags, auto &&func )
1854{
1855 std::optional<std::string> valueOverride;
1856 if ( shouldExposeTextInputToTestEngine( flags ) )
1857 {
1858 valueOverride = TestEngine::createValue( label, array );
1859 if ( valueOverride && size > 0 )
1860 {
1861 // How many bytes (excluding `\0`) can we emit?
1862 std::size_t n = std::min( size - 1, valueOverride->size() );
1863 std::memcpy( array, valueOverride->c_str(), n );
1864 }
1865 }
1866
1867 bool ret = func();
1868
1869 if ( valueOverride )
1870 {
1871 detail::markItemEdited( ImGui::GetID( label ) );
1872 ret = true;
1873 }
1874
1875 return ret;
1876}
1877
1878bool inputText( const char* label, std::string& str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data )
1879{

Callers 2

inputTextIntoArrayFunction · 0.85

Calls 4

minFunction · 0.85
createValueFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected