示例#1
0
std::string BaseRowsetReader::iterator::GetAsString( size_t index ) const
{
    const PyRep::PyType t = GetType( index );

    switch( t )
    {
    case PyRep::PyTypeNone:
        return "NULL";
    case PyRep::PyTypeBool:
        return itoa( GetBool( index ) ? 1 : 0 );
    case PyRep::PyTypeInt:
        return itoa( GetInt( index ) );
    case PyRep::PyTypeLong:
        return itoa( GetLong( index ) );
    case PyRep::PyTypeFloat:
        {
            char buf[64];
            snprintf( buf, 64, "%f", GetFloat( index ) );
            return buf;
        }
    case PyRep::PyTypeString:
        {
            std::string str = GetString( index );
            EscapeString( str, "'", "\\'" );

            str.insert( str.begin(), '\'' );
            str.insert( str.end(),   '\'' );

            return str;
        }
    case PyRep::PyTypeWString:
        {
            std::string str = GetWString( index );
            EscapeString( str, "'", "\\'" );

            str.insert( str.begin(), '\'' );
            str.insert( str.end(),   '\'' );

            return str;
        }
    default:
        {
            char buf[64];
            snprintf( buf, 64, "'UNKNOWN TYPE %u'", t );
            return buf;
        }
    }
}
示例#2
0
void LineEdit::DragAndDrop(Point p, PasteClip& d)
{
	if(IsReadOnly()) return;
	int c = GetMousePos(p);
	if(AcceptText(d)) {
		NextUndo();
		int a = sb.y;
		int sell, selh;
		WString text = GetWString(d);
		if(GetSelection(sell, selh)) {
			if(c >= sell && c < selh) {
				if(!IsReadOnly())
					RemoveSelection();
				if(IsDragAndDropSource())
					d.SetAction(DND_COPY);
				c = sell;
			}
			else
			if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
				if(c > sell)
					c -= selh - sell;
				if(!IsReadOnly())
					RemoveSelection();
				d.SetAction(DND_COPY);
			}
		}
		int count = Insert(c, text);
		sb.y = a;
		SetFocus();
		SetSelection(c, c + count);
		Action();
		return;
	}
	if(!d.IsAccepted()) return;
	if(!isdrag) {
		isdrag = true;
		ScrollIntoCursor();
	}
	Point dc = Null;
	if(c >= 0)
		dc = GetColumnLine(c);
	if(dc != dropcaret) {
		RefreshDropCaret();
		dropcaret = dc;
		RefreshDropCaret();
	}
}
示例#3
0
void DocEdit::DragAndDrop(Point p, PasteClip& d)
{
	if(IsReadOnly()) return;
	int c = GetMousePos(p);
	if(AcceptText(d)) {
		NextUndo();
		int a = sb;
		int sell, selh;
		WString txt = GetWString(d);
		if(GetSelection(sell, selh)) {
			if(c >= sell && c < selh) {
				if(!IsReadOnly())
					RemoveSelection();
				if(IsDragAndDropSource())
					d.SetAction(DND_COPY);
				c = sell;
			}
			else
			if(d.GetAction() == DND_MOVE && IsDragAndDropSource()) {
				if(c > sell)
					c -= selh - sell;
				if(!IsReadOnly())
					RemoveSelection();
				d.SetAction(DND_COPY);
			}
		}
		int count = Insert(c, txt);
		sb = a;
		SetFocus();
		SetSelection(c, c + count);
		Action();
		return;
	}
	if(!d.IsAccepted()) return;
	Point dc = Null;
	if(c >= 0) {
		Point cr = GetCaret(c);
		dc = Point(cr.x + 1, cr.y);
	}
	if(dc != dropcaret) {
		RefreshDropCaret();
		dropcaret = dc;
		RefreshDropCaret();
	}
}
示例#4
0
文件: CXml.cpp 项目: karlosos/Tertius
	//Metoda zwraca atrybut wskazanego typu
	std::wstring CXml::GetWString(const std::string &node_name, const std::string &attrib_name)
	{
		if (m_xml_root)
			return GetWString(m_xml_root->first_node(node_name.c_str()), attrib_name);
		return L"";
	}