MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / write

Method write

Engine/source/gui/core/guiControl.cpp:1837–1883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1835//-----------------------------------------------------------------------------
1836
1837void GuiControl::write(Stream &stream, U32 tabStop, U32 flags)
1838{
1839 //note: this will return false if either we, or any of our parents, are non-save controls
1840 bool bCanSave = ( flags & IgnoreCanSave ) || ( flags & NoCheckParentCanSave && getCanSave() ) || getCanSaveParent();
1841
1842 if (bCanSave && mAddGroup)
1843 {
1844 StringTableEntry steName = mAddGroup->getInternalName();
1845
1846 if ((steName != NULL) && (steName != StringTable->insert("null")) && getName())
1847 {
1848 MutexHandle handle;
1849 handle.lock(mMutex);
1850
1851 // export selected only?
1852 if ((flags & SelectedOnly) && !isSelected())
1853 {
1854 for (U32 i = 0; i < size(); i++)
1855 (*this)[i]->write(stream, tabStop, flags);
1856
1857 return;
1858
1859 }
1860
1861 stream.writeTabs(tabStop);
1862 char buffer[1024];
1863 dSprintf(buffer, sizeof(buffer), "new %s(%s,%s) {\r\n", getClassName(), getName() ? getName() : "", mAddGroup->getInternalName());
1864 stream.write(dStrlen(buffer), buffer);
1865 writeFields(stream, tabStop + 1);
1866
1867 if (size())
1868 {
1869 stream.write(2, "\r\n");
1870 for (U32 i = 0; i < size(); i++)
1871 (*this)[i]->write(stream, tabStop + 1, flags);
1872 }
1873
1874 stream.writeTabs(tabStop);
1875 stream.write(4, "};\r\n");
1876
1877 return;
1878 }
1879 }
1880
1881 if (bCanSave)
1882 Parent::write( stream, tabStop, flags );
1883}
1884
1885//=============================================================================
1886// Hierarchies.

Callers 1

saveSelectionMethod · 0.45

Calls 10

isSelectedFunction · 0.85
dSprintfFunction · 0.85
getInternalNameMethod · 0.80
writeTabsMethod · 0.80
getNameFunction · 0.50
sizeFunction · 0.50
dStrlenFunction · 0.50
writeFunction · 0.50
insertMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected