yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1#ifndef SLANG_CORE_COMMAND_OPTIONS_WRITER_H 2#define SLANG_CORE_COMMAND_OPTIONS_WRITER_H 3 4#include "slang-command-options.h" 5 6namespace Slang 7{ 8 9class CommandOptionsWriter :public RefObject 10{ 11public : 12typedef CommandOptions ::CategoryKind CategoryKind ; 13typedef CommandOptions ::NameKey NameKey ; 14typedef CommandOptions ::LookupKind LookupKind ; 15 16enum class Style 17 { 18Text ,///< Suitable for output to a terminal 19Markdown ,///< Markdown 20NoLinkMarkdown ,///< Markdown without links 21 }; 22 23static ConstArrayView < NamesDescriptionValue > getStyleInfos (); 24 25struct Options 26 { 27Style style = Style ::Text ;///< The style 28Index lineLength = 120 ;///< The maximum amount of characters on a line 29UnownedStringSlice indent = toSlice (" "); 30 ; 31 }; 32 33/// Append descirption for a category 34void appendDescriptionForCategory (CommandOptions * options ,Index categoryIndex ); 35/// Appends a description of all of the options 36void appendDescription (CommandOptions * options ); 37 38/// Get the builder that string is being written to 39StringBuilder & getBuilder () {return m_builder ; } 40 41static RefPtr < CommandOptionsWriter > create (const Options & options ); 42 43 44protected : 45/// Append descirption for a category 46virtual void appendDescriptionForCategoryImpl (Index categoryIndex )= 0 ; 47/// Appends a description of all of the options 48virtual void appendDescriptionImpl ()= 0 ; 49 50// Ctor, use create to create a writer 51CommandOptionsWriter (const Options & options ); 52 53/// Get the length of the current line in ascii chars/bytes 54Count _getCurrentLineLength (); 55 56/// Indentation/wrapping 57void _requireIndent (Count indentCount ); 58void _appendWrappedIndented ( 59Count indentCount , 60List < UnownedStringSlice >& slices , 61const UnownedStringSlice & delimit ); 62 63CommandOptions * m_commandOptions = nullptr ; 64 65StringSlicePool m_pool ; 66StringBuilder m_builder ; 67Options m_options ; 68}; 69 70}// namespace Slang 71 72#endif