Beispiel #1
0
int main(int argc, char const* argv[])
{
    char aaa[12]="julywoaini";
    char b='w';
    int c;
    c = where(b,aaa);
    printf("lacation is:%d\n",c);
    printf("aaa[%d]\n",c);
    return 0;
}
Beispiel #2
0
void from(char *tok) 
{ 
  char *token;     
  if (!strcmp(tok, "from")) 
    { 
      token = strtok(NULL, " ");   
      where(token);     
    } 
  else puts("From error! \n");      
}
Beispiel #3
0
void Highscore::draw() {
    Rect where( 550,200,300,300 );
    SDL_Color color( {240,240,250} );

    pWriterPtr->draw(where,"GAME OVER", color);

    where.y += 40;

    pWriterPtr->draw(where, "Result: " + LiveBar::getResult() + "m", color );
}
Beispiel #4
0
int main()
{
    int numBenchmarks = 5;
    if (runvector) numBenchmarks++;
#ifdef BENCHMARK_VALARRAY
    numBenchmarks++;
#endif
#ifdef FORTRAN_90
    numBenchmarks++;
#endif

    BenchmarkExt<int> bench("floop8: $x = u/$a", numBenchmarks);

    bench.setNumParameters(numSizes);

    Array<int,1> parameters(numSizes);
    Array<long,1> iters(numSizes);
    Array<double,1> flops(numSizes);

    parameters=pow(pow(2.,0.25),tensor::i)+tensor::i;
    flops = 1 * parameters;
    iters = 100000000L / flops;
    iters = where(iters<2, 2, iters);
    cout << iters << endl;
    
    bench.setParameterVector(parameters);
    bench.setIterations(iters);
    bench.setOpsPerIteration(flops);
    bench.setDependentVariable("flops");
    bench.beginBenchmarking();

    float u = 0.39123982498157938742;


    ArrayVersion(bench, u);
    ArrayVersion_unaligned(bench, u);
    ArrayVersion_misaligned(bench, u);
    ArrayVersion_index(bench, u);
    //doTinyVectorVersion(bench, u);
    F77Version(bench, u);
#ifdef FORTRAN_90
    F90Version(bench, u);
#endif
#ifdef BENCHMARK_VALARRAY
    ValarrayVersion(bench, u);
#endif

    if(runvector)
      VectorVersion(bench, u);

    bench.endBenchmarking();

    bench.saveMatlabGraph("floop8.m");
    return 0;
}
Beispiel #5
0
PRIVATE void nw_init()
{
#if DEBUG & 256
 { where(); printf("starting mq_init()\n"); }
#endif
	mq_init();
#if DEBUG & 256
 { where(); printf("starting bf_init()\n"); }
#endif
	bf_init();
#if DEBUG & 256
 { where(); printf("starting clck_init()\n"); }
#endif
	clck_init();
#if DEBUG & 256
 { where(); printf("starting sr_init()\n"); }
#endif
	sr_init();
#if DEBUG & 256
 { where(); printf("starting eth_init()\n"); }
#endif
	eth_init();
#if DEBUG & 256
 { where(); printf("starting arp_init()\n"); }
#endif
#if ENABLE_ARP
	arp_init();
#endif
#if DEBUG & 256
 { where(); printf("starting ip_init()\n"); }
#endif
#if ENABLE_IP
	ip_init();
#endif
#if DEBUG & 256
 { where(); printf("starting tcp_init()\n"); }
#endif
#if ENABLE_TCP
	tcp_init();
#endif
#if DEBUG & 256
 { where(); printf("starting udp_init()\n"); }
#endif
#if ENABLE_UDP
	udp_init();
#endif
}
Beispiel #6
0
void GraphEditor::handleAddBlock(const Poco::JSON::Object::Ptr &blockDesc)
{
    if (not this->isVisible()) return;
    QPointF where(std::rand()%100, std::rand()%100);

    //determine where, a nice point on the visible drawing area sort of upper left
    auto view = dynamic_cast<QGraphicsView *>(this->currentWidget());
    where += view->mapToScene(this->size().width()/4, this->size().height()/4);

    this->handleAddBlock(blockDesc, where);
}
Beispiel #7
0
	navigator::find_results navigator::find_descendent(node_name str) const
	{
		auto all = find_descendent_r(str);
		find_results results;
		auto here = where();
		for(auto const& pth : all)
		{
			auto depth = pth.length() - here.length();
			results.by_location[find_results::result_location{ 0, depth }].push_back(pth);
		}
		return results;
	}
Beispiel #8
0
int Where(int, char* [])
{
  const auto foo = test::TabFoo{};
  const auto bar = test::TabBar{};

  // Unconditionally
  compare(__LINE__, select(foo.omega).from(foo).unconditionally(), "SELECT tab_foo.omega FROM tab_foo");
  compare(__LINE__, remove_from(foo).unconditionally(), "DELETE FROM tab_foo");
  compare(__LINE__, update(foo).set(foo.omega = 42).unconditionally(), "UPDATE tab_foo SET omega=42");
  compare(__LINE__, where(sqlpp::value(true)), " WHERE " + getTrue());

  // Never
  compare(__LINE__, where(sqlpp::value(false)), " WHERE " + getFalse());

  // Sometimes
  compare(__LINE__, where(bar.gamma), " WHERE tab_bar.gamma");
  compare(__LINE__, where(bar.gamma == false), " WHERE (tab_bar.gamma=" + getFalse() + ")");
  compare(__LINE__, where(bar.beta == "SQL"), " WHERE (tab_bar.beta='SQL')");

  return 0;
}
Beispiel #9
0
/*virtual*/ int gui_filterbar_c::full_search_s::iterate(int pass)
{
    // mtype 0 == MTA_MESSAGE
    // mtype 107 == MTA_UNDELIVERED_MESSAGE

    ts::str_c where(CONSTASTR("(mtype == 0 or mtype == 107) and msg like \"%"));
    where.encode_pointer(&flt).append(CONSTASTR("\" order by mtime") );

    db->read_table(CONSTASTR("history"), DELEGATE(this, reader), where);

    return R_DONE;
}
int main()
{
Array<float,2> test(8,8), test2(5,5) ;

test = 5;

Range I(2,6) ;
Range J(3,7) ;

// Koenig lookup hack
#if defined(__GNUC__) && (__GNUC__ < 3)
test2 = where(blitz::operator> (test(I,J), test(I-1,J)), 0, test(I,J));
#else
test2 = where(test(I,J) > test(I-1,J), 0, test(I,J));
#endif

BZTEST(test2(3,3) == 5);

cout << test2 << endl ;

}
	void JavaError::format_error(Base::mstring & out) const {
		wchar_t buf[Base::MAX_PATH_LEN] = {0};

		_snwprintf(buf, Base::lengthof(buf), L"Error: %s", what().c_str());
		out.push_back(buf);
#ifndef NDEBUG
		_snwprintf(buf, Base::lengthof(buf), L"Exception: %s", type().c_str());
		out.push_back(buf);
		_snwprintf(buf, Base::lengthof(buf), L"Where: %s", where());
		out.push_back(buf);
#endif
	}
Beispiel #12
0
status_t perform_edit(MTextAddOn *addon)
{
	status_t result = B_OK;
	entry_ref headerFile;
	BPoint where(0,0);

	if (addon->Window() && addon->Window()->Lock())
	{
		uint32 buttons;
		addon->Window()->ChildAt(0)->GetMouse(&where, &buttons);
		addon->Window()->ChildAt(0)->ConvertToScreen(&where);
		addon->Window()->Unlock();
		where += BPoint(-3,-3);
	}

	result = addon->GetRef(headerFile);
	BString fileName;
	if (result >= B_OK)
		fileName = headerFile.name;

	CLanguageInterface *languageInterface = NULL;
	if (addon->Window())
	{
		PDoc *doc = dynamic_cast<PDoc *>(addon->Window());
		if (doc && doc->TextView())
		{
			int lang = doc->TextView()->Language();
			if (lang > -1)
				languageInterface = CLanguageInterface::FindIntf(lang);
		}
	}

	BString header;
	result = RunPopUpMenu(where, header, fileName, languageInterface);
	//printf("result %s\n", strerror(result));
	if (result == B_CANCELED)
		return B_OK;
	if (result < B_OK)
		return result;

#if 0
	// Do not change the case if a shift key was pressed
	if ((modifiers() & B_SHIFT_KEY) == 0)
		fileName.ToUpper();
#endif

	addon->Select(0, 0);

	addon->Insert(header.String());
	
	return result;
}
Beispiel #13
0
static void setup_utmp(int mode) {
    userinfo_t uinfo;
    char buf[80];
    char remotebuf[1024];
    time_t now = time(NULL);
    
    memset(&uinfo, 0, sizeof(uinfo));
    uinfo.pid = currpid = getpid();
    uinfo.uid = usernum;
    uinfo.mode = currstat = mode;
    uinfo.msgcount = 0;
    if(!(cuser.numlogins % 20) &&
       cuser.userlevel & PERM_BM)
	check_BM();	/* Ptt 自動取下離職板主權力 */
    
    uinfo.userlevel = cuser.userlevel;
    uinfo.lastact = time(NULL);
    
    postrecord.times = 0;	/* 計算crosspost數 */
    
    strcpy(uinfo.userid, cuser.userid);
    strcpy(uinfo.realname, cuser.realname);
    strcpy(uinfo.username, cuser.username);
    strncpy(uinfo.from, fromhost, 23);
    
    uinfo.five_win = cuser.five_win;
    uinfo.five_lose = cuser.five_lose;
    uinfo.five_tie = cuser.five_tie;
    
    uinfo.invisible = cuser.invisible % 2;
    uinfo.pager = cuser.pager % 5;
    
    uinfo.brc_id = 0;
#ifdef WHERE
    uinfo.from_alias = where(fromhost);
#else
    uinfo.from_alias = 0;
#endif
    setuserfile(buf, "remoteuser");
    
    strcpy(remotebuf, getenv("RFC931"));
    strcat(remotebuf, ctime(&now));
    remotebuf[strlen(remotebuf)-1] = 0;
    add_distinct(buf, remotebuf);
    
    if(enter_uflag & CLOAK_FLAG)
	uinfo.invisible = YEA;
    getnewutmpent(&uinfo);
#ifndef _BBS_UTIL_C_
    friend_load();
#endif
}
Beispiel #14
0
void access_violation::writelog(const char *prefix) const
{
  if( prefix )
    if( mAccessType == Write)
      CLog::Log(LOGERROR, "%s : %s at 0x%08x: Writing location 0x%08x", prefix, what(), where(), address());
    else if( mAccessType == Read)
      CLog::Log(LOGERROR, "%s : %s at 0x%08x: Reading location 0x%08x", prefix, what(), where(), address());
    else if( mAccessType == DEP)
      CLog::Log(LOGERROR, "%s : %s at 0x%08x: DEP violation, location 0x%08x", prefix, what(), where(), address());
    else
      CLog::Log(LOGERROR, "%s : %s at 0x%08x: unknown access type, location 0x%08x", prefix, what(), where(), address());
  else
    if( mAccessType == Write)
      CLog::Log(LOGERROR, "%s at 0x%08x: Writing location 0x%08x", what(), where(), address());
    else if( mAccessType == Read)
      CLog::Log(LOGERROR, "%s at 0x%08x: Reading location 0x%08x", what(), where(), address());
    else if( mAccessType == DEP)
      CLog::Log(LOGERROR, "%s at 0x%08x: DEP violation, location 0x%08x", what(), where(), address());
    else
      CLog::Log(LOGERROR, "%s at 0x%08x: unknown access type, location 0x%08x", what(), where(), address());

}
Beispiel #15
0
void free_top_of(int blk)
{
	int i, j, x, p = where(blk);

	for (i = 0; tab[p].b[i] != blk; i++);

	for (x = ++i; i < tab[p].count; i++) {
		j = tab[p].b[i];
		tab[j].b[tab[j].count++] = j;	/* return to position 'j' */
	}

	tab[p].count = x;
}
Beispiel #16
0
int main()
{
    const int N = 5;
    Array<int,1> A(N), B(N), C(N), D(N), E(N);

    A =  0,  3, -2,  5, -4;
    B =  0,  1,  2,  3,  4;
    C = 10, 11, 12, 13, 14;

    D = where(A > 0, pow2(B), pow2(C));

    E =  100, 1, 144, 9, 196;

    BZTEST(count(D == E) == N);

    D = where(A > 0, A, 0);
    E = 0, 3, 0, 5, 0;

    BZTEST(count(D == E) == N);

    return 0;
}
Beispiel #17
0
bool FLUtil::writeDBSettingEntry(const QString &key, const QString &value)
{
  int size;
  bool result;
  QString where(QString::fromLatin1("flkey='") + key + QString::fromLatin1("'"));
  sqlSelect("flsettings", "valor", where, "flsettings", &size);
  if (size > 0) {
    result = sqlUpdate("flsettings", "valor", value, where);
  } else {
    result = sqlInsert("flsettings", "flkey,valor", key + QString::fromLatin1(",") + value);
  }
  return result;
}
Beispiel #18
0
int CustomQuery(int, char*[])
{
  const auto foo = test::TabFoo{};
  const auto bar = test::TabBar{};
  auto db = MockDb{};

  // Unconditionally
  compare(__LINE__,
          custom_query(sqlpp::select(), select_flags(sqlpp::distinct), select_columns(foo.omega), from(foo),
                       sqlpp::unconditionally()),
          "SELECT  DISTINCT  tab_foo.omega  FROM tab_foo ");

  // A full select statement made individual clauses
  compare(__LINE__,
          custom_query(sqlpp::select(), select_flags(sqlpp::distinct), select_columns(foo.omega),
                       from(foo.join(bar).on(foo.omega == bar.alpha)), where(bar.alpha > 17), group_by(foo.omega),
                       having(avg(bar.alpha) > 19), order_by(foo.omega.asc()), sqlpp::limit(10u), sqlpp::offset(100u)),
          "SELECT  DISTINCT  tab_foo.omega  FROM tab_foo INNER JOIN tab_bar ON (tab_foo.omega=tab_bar.alpha)  WHERE "
          "(tab_bar.alpha>17)  GROUP BY tab_foo.omega  HAVING (AVG(tab_bar.alpha)>19)  ORDER BY tab_foo.omega ASC  "
          "LIMIT 10  OFFSET 100");

  // A full select statement made individual clauses
  compare(
      __LINE__,
      custom_query(sqlpp::select(), dynamic_select_flags(db, sqlpp::distinct), dynamic_select_columns(db, foo.omega),
                   dynamic_from(db, foo.join(bar).on(foo.omega == bar.alpha)), dynamic_where(db, bar.alpha > 17),
                   dynamic_group_by(db, foo.omega), dynamic_having(db, avg(bar.alpha) > 19),
                   dynamic_order_by(db, foo.omega.asc(), foo.psi.order(sqlpp::sort_type::desc)),
                   sqlpp::dynamic_limit(db), sqlpp::dynamic_offset(db)),
      "SELECT  DISTINCT  tab_foo.omega  FROM tab_foo INNER JOIN tab_bar ON (tab_foo.omega=tab_bar.alpha)  WHERE "
      "(tab_bar.alpha>17)  GROUP BY tab_foo.omega  HAVING (AVG(tab_bar.alpha)>19)  ORDER BY tab_foo.omega "
      "ASC,tab_foo.psi DESC  ");

  // A pragma query for sqlite
  compare(__LINE__,
          custom_query(sqlpp::verbatim("PRAGMA user_version")).with_result_type_of(select(sqlpp::value(1).as(pragma))),
          " PRAGMA user_version");

  // An insert from select for postgresql
  const auto x = 17;
  compare(__LINE__,
          custom_query(insert_into(foo).columns(foo.omega),
                       select(sqlpp::value(x).as(foo.omega))
                           .from(foo)
                           .where(not exists(select(foo.omega).from(foo).where(foo.omega == x)))),
          "INSERT INTO tab_foo (omega) "
          "SELECT 17 AS omega FROM tab_foo "
          "WHERE (NOT EXISTS(SELECT tab_foo.omega FROM tab_foo WHERE (tab_foo.omega=17)))");

  return 0;
}
Beispiel #19
0
// Moved snapper
long ShutterBug::onMovedSnapper(FXObject*,FXSelector sel,void* ptr){
  register FXint which=FXSELID(sel)-ID_SNAPPER_0;
  register FXEvent *event=(FXEvent*)ptr;
  register FXuchar m;
  FXint t;
  FXTRACE((1,"%s::onMovedSnapper %d,%d\n",getClassName(),((FXEvent*)ptr)->win_x,((FXEvent*)ptr)->win_y));
  if(mode!=MODE_NONE){

    // Move whole rectangle
    if(mode&MODE_WHOLERECT){
      rectangle.x=event->root_x-spotx;
      rectangle.y=event->root_y-spoty;
      }

    // Move corner of rectangle
    else{

      // Vertical
      if(mode&MODE_TOP){
        t=rectangle.y+rectangle.h-event->root_y+spoty;
        if(t>=MINSIZE){ rectangle.h=t; rectangle.y=event->root_y-spoty; }
        }
      else if(mode&MODE_BOTTOM){
        t=event->root_y-spoty-rectangle.y;
        if(t>=MINSIZE){ rectangle.h=t; }
        }

      // Horizontal
      if(mode&MODE_LEFT){
        t=rectangle.x+rectangle.w-event->root_x+spotx;
        if(t>=MINSIZE){ rectangle.w=t; rectangle.x=event->root_x-spotx; }
        }
      else if(mode&MODE_RIGHT){
        t=event->root_x-spotx-rectangle.x;
        if(t>=MINSIZE){ rectangle.w=t; }
        }
      }

    // Update rectangle
    moveSnapRectangle(rectangle);
    m=mode;
    }
  else{
    if((event->state&CONTROLMASK) || size)
      m=MODE_WHOLERECT;
    else
      m=where(event->root_x,event->root_y);
    }
  changeCursor(which,m);
  return 1;
  }
Beispiel #20
0
void
ViewBuffer::_RenderGlyph(int32 x, int32 y, const char* string, uint8 attr, bool fill)
{
	BPoint where(x * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 3);
	
	SetHighColor(GetPaletteEntry(ForegroundColor(attr)));
	if (fill) {
		SetLowColor(GetPaletteEntry(BackgroundColor(attr)));
		FillRect(BRect(x * CHAR_WIDTH, y * CHAR_HEIGHT,
					   (x + 1) * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT),
				 B_SOLID_LOW);
	}
	DrawString(string, where);
}
Beispiel #21
0
MojErr MojDbQuery::includeDeleted(bool val)
{
	if (val) {
		MojObject array;
		MojErr err = array.push(false);
		MojErrCheck(err);
		err = array.push(true);
		MojErrCheck(err);
		// TODO: Move string constants to single location
		err = where(DelKey, MojDbQuery::OpEq, array);
		MojErrCheck(err);
	}
	return MojErrNone;
}
Beispiel #22
0
void Highscore::show(){

	SDL_Color color( {240,240,250} );
    Property::get("HIGH_GAME_DIST");
    pWriterPtr->setFont("bold_big");
    Rect where({40,40,200,200});
    pWriterPtr->draw(where ,"HIGHSCORE" );
    
	for( uint i=0; i<pList.size(); ++i ) {
		where.y += 30;
		if( pList[i].name.size() > 0 )
			pWriterPtr->draw(where, pList[i].name , color );
	}
}
Beispiel #23
0
cppdom::Document PredTest::loadGameDoc()
{
   cppdom::ContextPtr ctx( new cppdom::Context );
   cppdom::Document doc( ctx );
   std::string filename(cppdomtest::game_xml_filename);
   
   try
   {
      doc.loadFile( filename );
   }
   catch (cppdom::Error e)
  {
     cppdom::Location where( ctx->getLocation() );
     std::string errmsg = e.getStrError();

     // print out where the error occured
     std::cout << filename << ":" << where.getLine() << " "
               << "at position " << where.getPos()
               << ": error: " << errmsg.c_str()
               << std::endl;

     // print out line where the error occured
     std::ifstream errfile( filename.c_str() );
     if(!errfile)
     {
        std::cerr << "Can't open file [" << filename << "] to output error" << std::endl;
     }

     int linenr = where.getLine();
     char linebuffer[1024];
     for(int i=0; i<linenr && !errfile.eof(); i++)
        errfile.getline( linebuffer,1024 );

     int pos = where.getPos();
     if (pos>=80)
        pos %= 80;

     std::string err_line( linebuffer + (where.getPos()-pos) );
     if (err_line.length()>=79)
        err_line.erase(79);
     std::cout << err_line << std::flush
               << err_line.c_str() << std::endl
               << linebuffer << std::endl;
     for(int j=2;j<pos;j++)
        std::cout << " ";
     std::cout << '^' << std::endl;
  }

   return doc;
}
void JSSPageReader::parseAttributes()
{
	static const int eof = std::char_traits<char>::eof();

	std::string basename;
	std::istringstream istr(_attrs);
	int ch = istr.get();
	while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	while (ch != eof && Poco::Ascii::isAlphaNumeric(ch)) { basename += (char) ch; ch = istr.get(); }
	while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	while (ch != eof)
	{
		std::string name(basename + ".");
		std::string value;
		while (ch != eof && Poco::Ascii::isAlphaNumeric(ch)) { name += (char) ch; ch = istr.get(); }
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
		if (ch != '=') throw Poco::SyntaxException("Bad attribute syntax: '=' expected", where());
		ch = istr.get();
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
		if (ch == '"')
		{
			ch = istr.get();
			while (ch != eof && ch != '"') { value += (char) ch; ch = istr.get(); }
			if (ch != '"') throw Poco::SyntaxException("Bad attribute syntax: '\"' expected", where());
		}
		else if (ch == '\'')
		{
			ch = istr.get();
			while (ch != eof && ch != '\'') { value += (char) ch; ch = istr.get(); }
			if (ch != '\'') throw Poco::SyntaxException("Bad attribute syntax: ''' expected", where());
		}
		else throw Poco::SyntaxException("Bad attribute syntax: '\"' or ''' expected", where());
		ch = istr.get();
		handleAttribute(name, value);
		while (ch != eof && Poco::Ascii::isSpace(ch)) ch = istr.get();
	}
}
Beispiel #25
0
void Search::property_id_search(string input, vector<int> &results) {
	
	/** Note the results is a list of the integers--in the correct order and compressed **/

	// DATABASE QUERY VECTORS
	vector<string> * categories, select_list;
	vector<where_statement> where (1);
	vector<row_result> query_results;
	
	// RESULTS ANALYSIS
	vector<int>raw_list;
	vector<integer_key_value> key_value_results;
	categories = &configuration.search_categories;

	// Vanilla variables -- helpers
	string * category, table;
	int * property_id;
	
	input = helper.string_to_lower(input);
	select_list.push_back("property_id");//we only want to grab the id for each property
	where[0].column_value = input;
	
	
	for (int i = 0; i< (* categories).size(); i++) {//get a list of the tables to query

		category = &(* categories)[i];//this is the current category

		where[0].column_name = * category;
		
		table = category_table(* category);//table to be queried
		
		database.query_like(table, select_list, where, query_results);//actually grab the ids--the results will constantly be added to!
		
	}

	for (int i = 0; i < query_results.size(); i++) {
		
		property_id = & query_results[i].row_column[0].integer_value;

		if(* property_id > 0)
			raw_list.push_back(* property_id);//push the integer into the vector of raw integers!
	} 

	duplicates(raw_list, key_value_results);
	
	sort(key_value_results, results);
	
	key_value_results.clear();
}
Beispiel #26
0
		void base_node_state::on_load(clsm::ev_cmd< load_cmd > const& cmd)
		{
			auto& editor = context< paramtree_editor >();
			auto acc = editor.acc;

			qualified_path path;
			if(cmd.nav)
			{
				path = nav_cmd_path(*cmd.nav);
				if(!path)
				{
					editor.output("invalid path specified");
					return;// false;
				}
			}
			else
			{
				path = acc.where();
			}

			auto as_yaml = YAML::LoadFile(cmd.filename);
			if(as_yaml.IsNull())
			{
				editor.output("invalid filename/file");
				return;// false;
			}

			auto subtree_root = acc.node_at(path);
			auto& tree = editor.ptree.tree();
			tree.clear_children(subtree_root);

			editor.ptree.generate_from_yaml(as_yaml, subtree_root);

			/* TODO: generate from yaml does not validate loaded params against schema...

			bool ok = schema::validate_param(cmd.val, sch);
			if(!ok)
			{
			os << "invalid value" << std::endl;
			return false;
			}
			*/
			// TODO: Overkill
			editor.reload_pt_schema();

			// TODO: if load into node which is above current location, current location may cease to exist,
			// in which case need to move the accessor, and transition to node_type_choice
			editor.output("subtree loaded");
		}
Beispiel #27
0
	void startElement(const Poco::XML::XMLString& uri, const Poco::XML::XMLString& localName, const Poco::XML::XMLString& qname, const Poco::XML::Attributes& attributes)
	{
		where("startElement");
		m_Msg.Message(Poco::format("    uri:       %s", uri));
		m_Msg.Message(Poco::format("    localName: %s", localName));
		m_Msg.Message(Poco::format("    qname:     %s", qname));
		if(0 != attributes.getLength())
		{
			m_Msg.Message("    Attributes: ");
			for(int i=0; i<attributes.getLength(); ++i)
			{
				m_Msg.Message(Poco::format("     %s=\"%s\"", attributes.getLocalName(i), attributes.getValue(i)));
			}
		}
	}
Beispiel #28
0
	void characters(const Poco::XML::XMLChar ch[], int start, int length)
	{
		int myStart = start;
		int myLength = length;
		while((0 != myLength) && (('\n' == ch[myStart]) || ('\t' == ch[myStart])))
		{
			++myStart;
			--myLength;
		}
		if(0 != myLength)
		{
			where("characters");
			m_Msg.Message(std::string(ch + myStart, myLength));
		}
	}
Beispiel #29
0
void TableModelApartment::load()
{
    QStringList vSql;
    vSql << select()
         <<", roomstable.name as rooms,"
         << "typeapartment.level as level, typeapartment.maxlevel as levels,"
         << "static_dictionaries.name as fund, area.total as total,"
         << "area.floor as floor, area.kitchen as kitchen,"
         << "s1.option, price.price as price"
         << ",address.city_fk as city_fk, address.number1 as number1, address.number2 as number2"
         << ",address.street_fk as street_fk, address.microdistrict_fk as microdistrict_fk"
         << ",address.city as city, address.street as street, address.number as number"
         << ",main_clients.fio as fio, main_clients.phone as phone"
         << from()
         << "INNER JOIN types ON objects.type_fk = types.id"
         << "LEFT JOIN typeapartment ON typeapartment.object_fk = objects.id"
         << "LEFT JOIN static_dictionaries ON static_dictionaries.id = typeapartment.fund_fk"
         << "LEFT JOIN static_dictionaries as roomstable ON roomstable.id = typeapartment.apartment_fk"
         << "LEFT JOIN area ON area.object_fk = objects.id"
         << "LEFT JOIN (SELECT dictionaries.name as option, objects.id as id, dictionaries.id as option_id FROM objects LEFT JOIN optionvalue ON objects.id = optionvalue.object_fk"
         << "INNER JOIN dictionaries ON optionvalue.value_fk = dictionaries.id AND dictionaries.parent = 24) as s1 ON s1.id = objects.id"

         //<< "LEFT JOIN optionvalue ON objects.id = optionvalue.object_fk"

         << "LEFT JOIN price ON price.object_fk = objects.id"
         << "LEFT JOIN clientheader ON clientheader.object_fk = objects.id"
         << "INNER JOIN main_clients ON clientheader.id = main_clients.header_fk"
         <<  "LEFT JOIN"
         << "(SELECT address_city.id as city_fk, address.number1 as number1, address.number2 as number2"
         << ",address_street.id as street_fk, address_microdistrict.id as microdistrict_fk"
         << ",address_city.name as city, address_street.name as street"
         << ",(case "
         << "WHEN address.number2 like '' THEN address.number1"
         << "WHEN address.number2 is NULL THEN address.number1"
         << "ELSE address.number1 || '/' || address.number2 "
         << "END) as number"
         << ", object_fk"
         << "FROM address "
         << "LEFT JOIN address_street ON address_street.id = address.street_fk "
         << "LEFT JOIN address_microdistrict ON address_microdistrict.id = address.microdistrict_fk"
         << "LEFT JOIN address_city ON address_street.city_fk = address_city.id OR address_microdistrict.city_fk = address_city.id"
         << ") as address"
         << "ON address.object_fk = objects.id"

         << where("types.type = 'apartment'")
         << "ORDER BY objects.id desc";
     mData = execQuery(vSql.join(" "));
}
Beispiel #30
0
double GCode::GetTimeEstimation() const
{
  Vector3d where(0,0,0);
  double time = 0, feedrate=0, distance=0;
  for (uint i=0; i<commands.size(); i++)
	{
	  if(commands[i].f!=0)
		feedrate = commands[i].f;
	  if (feedrate!=0) {
	    distance = (commands[i].where - where).length();
	    time += distance/feedrate*60.;
	  }
	  where = commands[i].where ;
	}
  return time;
}