// New style ctor Fl_File_Browser::Fl_File_Browser(const char* l,int layout_size,Fl_Align layout_al,int label_w) : Fl_ListView(l,layout_size,layout_al,label_w) { m_add_up_item = true; m_up_item = 0; callback(default_callback); when(FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE); data_source(&m_dir_ds); }
// Traditional ctor Fl_File_Browser::Fl_File_Browser(int x,int y,int w,int h,const char *l) : Fl_ListView(x, y, w, h, l) { m_add_up_item = true; m_up_item = 0; callback(default_callback); when(FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE); data_source(&m_dir_ds); }
bool leer_tablas(const std::string &archivo, std::vector<std::string> &nombre, std::vector<std::string> &cuerpo) { std::ifstream data_source (archivo); std::string linea, temp; if(!data_source.is_open()) { std::cout << "Imposible leer tablas de " << archivo << std::endl; return false; } while(std::getline(data_source, linea)) { if(linea[0] == '#') // Si encontramos comentario, seguimos. continue; if(linea.compare("<table>") == 0) { // Entramos en un bloque de tablas bool first_line = true; while(std::getline(data_source, linea)) { // Leemos el contenido de la tabla. if(linea[0] == '#') continue; if(linea.compare("</table>") != 0) { // Hasta encontrar el final. if(first_line) { // Primera linea, nombre de tabla. utiles::trim(linea); temp = "CREATE TABLE " + linea + " ("; nombre.push_back(linea); first_line = false; } else { temp += linea + ", "; } } else { // Fin de la tabla. Cerramos y a por la siguiente. // Reemplazmos la coma y el espacio finales por el cierre // de la sentencia CREATE. temp.replace(temp.end()-2, temp.end(), ");"); cuerpo.push_back(temp); break; } } } } return true; }
static int data_source_preload(void *vinstance, wsdata_t* source_data, ws_doutput_t *dout, int type_index) { proc_instance_t * proc = (proc_instance_t*)vinstance; int emitted = 0; int ret = 1; while (!proc->done && ret == 1) { wsdata_t *tuple = NULL; if ( source_data ) { tuple = source_data; source_data = NULL; } else { tuple = wsdata_alloc(dtype_tuple); } if ( !tuple ) { ret = 0; break; } ret = data_source(vinstance, tuple, dout, type_index); if ( !ret ) wsdata_delete(tuple); if ( ret ) emitted++; } proc->done = 1; return emitted; }
void add_data_source(const function_type& f, const std::string& title, const std::string& style, bool secondary_axis = false) { data_sources.push_back( data_source(history_capacity, f, title, style, secondary_axis)); }