// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_buf2lines #define tools_buf2lines #include #include #include //memcpy namespace tools { inline bool strings2buf(const std::vector& a_strings,size_t& a_size,char*& a_buffer) { // For {"aa","bbb"}, it produces "aa0bbb00". // For {""}, it produces "00". // For {}, it produces "0". size_t number = a_strings.size(); a_size = 0; for(size_t index=0;index& a_strings) { if(a_size<=1) return false; // We assume here a_size>=1 // Exa : if ab0cde00, then a_strings should contain two strings ab and cde. a_strings.clear(); char* begin = a_buffer; char* pos = a_buffer; size_t number = a_size-1; for(size_t index=0;index