Skip to content

Commit

Permalink
Per #1019, add StringArray::all_empty() member function to check for …
Browse files Browse the repository at this point in the history
…a list of all empty strings. This is used in ascii2nc to determine if observation units and descriptions should be written.
  • Loading branch information
JohnHalleyGotway committed Jan 13, 2025
1 parent 302e4d5 commit ef4d982
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/basic/vx_log/string_array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,31 @@ bool StringArray::has(const std::string text, int & index, bool forward) const
////////////////////////////////////////////////////////////////////////


bool StringArray::all_empty() const

{

bool all_empty = true;

//
// Search for non-empty string
//

for(auto &x : s) {
if(!x.size() == 0) {
all_empty = false;
break;
}
}

return all_empty;

}


////////////////////////////////////////////////////////////////////////


void StringArray::parse_wsss(const std::string text)

{
Expand Down
2 changes: 2 additions & 0 deletions src/basic/vx_log/string_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class StringArray {

bool has(const std::string, int & index, bool forward=true) const;

bool all_empty() const;

//
// parse delimited strings
//
Expand Down

0 comments on commit ef4d982

Please sign in to comment.