Defines a string which can store two substrings. Used for scanning noncontiguous (double) buffers.
SplitString | Defines a string which can store two substrings. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file SplitString. |
C-kern/ | Implementation file SplitString impl. |
Types | |
struct splitstring_t | Export splitstring_t into global namespace. |
Functions | |
test | |
unittest_string_splitstring | Test splitstring_t functionality. |
splitstring_t | Stores two contiguous sub strings. |
stringpart | The array of noncontinuous parts the string is composed of. |
nrofparts | The number of noncontinuous parts the string is composed of. |
lifetime | |
splitstring_FREE | Static initializer. |
free_splitstring | Sets all data members to 0. |
query | |
isfree_splitstring | Returns true if spstr equals splitstring_FREE. |
nrofparts_splitstring | Returns the nr of parts the string is composed of. |
addr_splitstring | Returns the start address of a part of the string at index stridx. |
size_splitstring | Returns size of a part of the string at index stridx. |
setter | |
setnrofparts_splitstring | Sets the nr of parts the string is composed of. |
setstring_splitstring | Sets the stringaddr and stringsize of a part of the string at index stridx. |
setsize_splitstring | Changes the size of the a part of the string at index stridx. |
inline implementation | |
Functions | |
free_splitstring | Implements splitstring_t.free_splitstring. |
addr_splitstring | Implements splitstring_t.addr_splitstring. |
size_splitstring | Implements splitstring_t.size_splitstring. |
nrofparts_splitstring | Implements splitstring_t.nrofparts_splitstring. |
setnrofparts_splitstring | Implements splitstring_t.setnrofparts_splitstring. |
setstring_splitstring | Implements splitstring_t.setstring_splitstring. |
setsize_splitstring | Implements <splitstring_t.setfirstsize_splitstring>. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2013 Jörg Seebohn
Header file SplitString.
Implementation file SplitString impl.
typedef struct splitstring_t splitstring_t
Export splitstring_t into global namespace.
test | |
unittest_string_splitstring | Test splitstring_t functionality. |
int unittest_string_splitstring( void )
Test splitstring_t functionality.
struct splitstring_t
Stores two contiguous sub strings. The first string (at index 0) stores the first part of the combined non-contiguous string and the last string (at index 1) stores the last part of the non-contiguous string.
stringpart | The array of noncontinuous parts the string is composed of. |
nrofparts | The number of noncontinuous parts the string is composed of. |
lifetime | |
splitstring_FREE | Static initializer. |
free_splitstring | Sets all data members to 0. |
query | |
isfree_splitstring | Returns true if spstr equals splitstring_FREE. |
nrofparts_splitstring | Returns the nr of parts the string is composed of. |
addr_splitstring | Returns the start address of a part of the string at index stridx. |
size_splitstring | Returns size of a part of the string at index stridx. |
setter | |
setnrofparts_splitstring | Sets the nr of parts the string is composed of. |
setstring_splitstring | Sets the stringaddr and stringsize of a part of the string at index stridx. |
setsize_splitstring | Changes the size of the a part of the string at index stridx. |
uint8_t nrofparts
The number of noncontinuous parts the string is composed of. The maximum supported value is 2. See also array stringpart.
bool isfree_splitstring( const splitstring_t * spstr )
Returns true if spstr equals splitstring_FREE.
const uint8_t * addr_splitstring( const splitstring_t * spstr, uint8_t stridx )
Returns the start address of a part of the string at index stridx. The returned value is only valid if nrofparts_splitstring is > stridx.
size_t size_splitstring( const splitstring_t * spstr, uint8_t stridx )
Returns size of a part of the string at index stridx. The returned value is only valid if nrofparts_splitstring is > stridx.
void setnrofparts_splitstring( splitstring_t * spstr, uint8_t number_of_parts )
Sets the nr of parts the string is composed of. Use the value 0 if the string is empty. Use the value 1 if only the first part is valid. Use value 2 if the first and last part are valid. A value > 2 is wrong and results in undefined behaviour.
Functions | |
free_splitstring | Implements splitstring_t.free_splitstring. |
addr_splitstring | Implements splitstring_t.addr_splitstring. |
size_splitstring | Implements splitstring_t.size_splitstring. |
nrofparts_splitstring | Implements splitstring_t.nrofparts_splitstring. |
setnrofparts_splitstring | Implements splitstring_t.setnrofparts_splitstring. |
setstring_splitstring | Implements splitstring_t.setstring_splitstring. |
setsize_splitstring | Implements <splitstring_t.setfirstsize_splitstring>. |
Implements splitstring_t.free_splitstring.
Implements splitstring_t.addr_splitstring.
Implements splitstring_t.size_splitstring.
Implements splitstring_t.nrofparts_splitstring.
Implements splitstring_t.setnrofparts_splitstring.
Implements splitstring_t.setstring_splitstring.
Export splitstring_t into global namespace.
typedef struct splitstring_t splitstring_t
Stores two contiguous sub strings.
struct splitstring_t
Test splitstring_t functionality.
int unittest_string_splitstring( void )
The array of noncontinuous parts the string is composed of.
string_t stringpart[2]
The number of noncontinuous parts the string is composed of.
uint8_t nrofparts
Static initializer.
#define splitstring_FREE { { string_FREE, string_FREE }, 0 }
Sets all data members to 0.
void free_splitstring( splitstring_t * spstr )
Returns true if spstr equals splitstring_FREE.
bool isfree_splitstring( const splitstring_t * spstr )
Returns the nr of parts the string is composed of.
uint8_t nrofparts_splitstring( const splitstring_t * spstr )
Returns the start address of a part of the string at index stridx.
const uint8_t * addr_splitstring( const splitstring_t * spstr, uint8_t stridx )
Returns size of a part of the string at index stridx.
size_t size_splitstring( const splitstring_t * spstr, uint8_t stridx )
Sets the nr of parts the string is composed of.
void setnrofparts_splitstring( splitstring_t * spstr, uint8_t number_of_parts )
Sets the stringaddr and stringsize of a part of the string at index stridx.
void setstring_splitstring( splitstring_t * spstr, uint8_t stridx, size_t stringsize, const uint8_t stringaddr[stringsize] )
Changes the size of the a part of the string at index stridx.
void setsize_splitstring( splitstring_t * spstr, uint8_t stridx, size_t stringsize )