42template<
typename TAllocator= lang::HeapAllocator>
63 for(
auto& str : *
this ) {
64 vectorBase::get_allocator().AIF().DeleteArray(
const_cast<nchar*
>(str.Buffer()),
102 constexpr int initialBufferSize = 4096;
103 constexpr int readSize = 1024 - 1;
108 FILE* pipe= popen(cmd,
"r");
109 #elif defined (_WIN32)
110 FILE* pipe= _popen(cmd,
"r");
112 #pragma message ("Unknown Platform in file: " __FILE__ )
120 if (!fgets(readBuffer.
VBuffer()+readBuffer.
Length(), readSize, pipe))
125 if ( readBuffer.
Length() < len )
130 int resultCode = pclose(pipe);
131 if (resultCode != -1) {
133 if (WIFEXITED(resultCode)) resultCode= WEXITSTATUS(resultCode);
136 else if (WIFSIGNALED(resultCode)) resultCode= 128 + WTERMSIG(resultCode);
138 #elif defined (_WIN32)
139 int resultCode = _pclose(pipe);
141 #pragma message ("Unknown Platform in file: " __FILE__ )
155 readBuffer.
Length() - origBufferLen ) ,
'\n');
integer DetectLength(integer offset=0)
TAString & Append(const TCharSrc *src, integer srcLength)
void EnsureRemainingCapacity(integer spaceNeeded)
TAString & TrimEnd(const TCString< TChar > &trimChars=CStringConstantsTraits< TChar >::DefaultWhitespaces())
constexpr integer Length() const
constexpr bool IsEmpty() const
constexpr const TChar * Buffer() const
TSubstring & TrimEnd(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
std::vector< TString< nchar >, lang::StdAllocator< TString< nchar >, TAllocator > > vectorBase
TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
@ Clear
Chooses to clear existing data.
@ Keep
Keep whitespaces in string.
strings::TString< nchar > NString
Type alias in namespace #"%alib".
strings::TCString< nchar > NCString
Type alias in namespace #"%alib".
system::TShellCommand< MonoAllocator > ShellCommandMA
Type alias in namespace #"%alib".
lang::integer integer
Type alias in namespace #"%alib".
system::TShellCommand< lang::HeapAllocator > ShellCommand
Type alias in namespace #"%alib".
constexpr NCString NNEW_LINE
A zero-terminated string containing the new-line character sequence.
characters::nchar nchar
Type alias in namespace #"%alib".
strings::util::TTokenizer< nchar > TokenizerN
Type alias in namespace #"%alib".
strings::TAString< nchar, AllocatorType > ReadBuffer
int Run(const NCString &cmd, lang::CurrentData keepData=lang::CurrentData::Clear)
TShellCommand()
Default constructor. Usable with type #"HeapAllocator".
TAllocator AllocatorType
The allocator type that TAllocator specifies.
strings::util::TStringVector< nchar, TAllocator > base
The vector type that TAllocator specifies.
base::vectorBase vectorBase
The vector type that TAllocator specifies.
TShellCommand(AllocatorType &ma)
static int Run(const NCString &cmd, strings::TAString< nchar, AllocatorType > &readBuffer, strings::util::TStringVector< nchar, TAllocator > *lines=nullptr)