当前位置: 首页>>代码示例>>C++>>正文


C++ Table::GetCount方法代码示例

本文整理汇总了C++中Table::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::GetCount方法的具体用法?C++ Table::GetCount怎么用?C++ Table::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table的用法示例。


在下文中一共展示了Table::GetCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ViewTable

void MailReaderFrame::ViewTable(Table pTable)
{
	ASSERT(0);
#if 0
	TableView* pTableView = new TableView;
	pTableView->m_list = new TreeControl;
	pTableView->m_table = pTable;
	pTableView->m_Canvas = pCanvas;

	int nfields = pTable.GetFieldCount();
	for (int i = 0; i < nfields; i++)
	{
		pTableView->m_list->m_treeHeader->AddColumn(new TextString(pTable.GetField(i)->GetName()));
	}

	try
	{
		int count = pTable.GetCount();

		for (int i = 0; i < count; i++)
		{
			Record pRecord = pTable[i];
			TreeItem* item = new TreeItem(pTableView->m_list);
			item->m_itemData = new IntObject(i);

			for (int f = 0; f < nfields; f++)
			{
				Field pField = pRecord[f];

				if (pField.GetDef()->GetType() == FTyp_VarString)
				{

					sysstring str;

					try
					{
						str = pField.GetStringA().ToStringW();
					}
					catch(int)
					{
						str = OLESTR("(Error)");
					}

					item->AppendColumnCell(new TextString(str));
				//	item->AppendColumnCell(new TextEdit(ConvertA2S((char*)pField->GetData(), pField->GetSize())));
				}
				else if (pField.GetDef()->GetType() == FTyp_Long)
				{
					OLECHAR buf[16];
					swprintf(buf, OLESTR("%d"), (long)pField.GetValue());
					item->AppendColumnCell(new TextEdit(buf));
				}
				else if (pField.GetDef()->GetType() == FTyp_ShortDate)
				{
					time_t tim = (long)pField.GetValue();
					tm* t = localtime((time_t*)&tim);
					if (t)
					{
						char buf[256];
						strftime(buf, 256, "%c", t);
						//swprintf(buf, OLESTR("%d"), pField->u.int32);
						item->AppendColumnCell(new TextString(ConvertA2S(buf, strlen(buf))));
					}
					else
						item->AppendColumnCell(new TextString(OLESTR("")));
				}
			}

			pTableView->m_list->get_Children()->AppendItem(item);
		}
	}
	catch(int)
	{
		char msg[256];
#if 0
		sprintf(msg, "Error reading database %s", pTable->get_filename().c_str());
#endif
		MessageBox(NULL/*GetHwnd()*/, msg, "", MB_OK);
	}

	{
		ChildWindow* pWindow = new ChildWindow;
		pWindow->put_Width(Length(200, Length::UnitAbsolute));
		pWindow->put_Height(Length(200, Length::UnitAbsolute));

		ScrollViewer* pScroller = new ScrollViewer;
		{
			pScroller->put_Content(pTableView->m_list);
		}
		pTableView->put_VisualTree(pScroller);

		pWindow->put_Content(pTableView);
		pWindow->put_TitleText(OLESTR("www.bredband.no"));
		pCanvas->AddChild(pWindow);
	}
#endif
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:97,代码来源:MailReaderFrame.cpp

示例2: db

MailReaderFrame::MailReaderFrame()
{
	{
#if 0
		{
			Table accounts;
			accounts.Open("C:\\accounts", "a+b");
			accounts.Append();

			accounts.AddField(OLESTR("ID"), FieldDef::FTyp_Long);
			accounts.AddField(OLESTR("Server"), FieldDef::FTyp_VarString);
			accounts.AddField(OLESTR("Username"), FieldDef::FTyp_VarString);
			accounts.AddField(OLESTR("Password"), FieldDef::FTyp_VarString);

			Record* pRecord = accounts.NewRecord();
			pRecord->m_fields[0]->u.int32 = 1;
			pRecord->m_fields[1]->SetData("pop.bredband.no");
			pRecord->m_fields[2]->SetData("sigler");
			pRecord->m_fields[3]->SetData("04bi1u6");

			pRecord->Write(&accounts);

			accounts.Close();
		}
#endif

#if 0
		{
			Table accounts;
			accounts.Open("C:\\news_accounts", "a+b");
			accounts.Append();

			accounts.AddField(OLESTR("ID"), FieldDef::FTyp_Long);
			accounts.AddField(OLESTR("Server"), FieldDef::FTyp_VarString);
		//	accounts.AddField(OLESTR("Username"), FieldDef::FTyp_VarString);
		//	accounts.AddField(OLESTR("Password"), FieldDef::FTyp_VarString);

			Record* pRecord = accounts.NewRecord();
			pRecord->m_fields[0]->u.int32 = 1;
			pRecord->m_fields[1]->SetData("freetext.usenetserver.com");
		//	pRecord->m_fields[2]->SetData("sigler");
		//	pRecord->m_fields[3]->SetData("04bi1u6");

			pRecord->Write(&accounts);

			accounts.Close();
		}
#endif

#if 0
		{
			Table* pTable = new Table;
			pTable->AddField(OLESTR("ID"), FieldDef::FTyp_Long);
			pTable->AddField(OLESTR("Subject"), FieldDef::FTyp_VarString);
			pTable->AddField(OLESTR("From"), FieldDef::FTyp_VarString);
			pTable->AddField(OLESTR("Headers"), FieldDef::FTyp_VarString);
			pTable->AddField(OLESTR("Content"), FieldDef::FTyp_VarString);
			pTable->AddField(OLESTR("Sent"), FieldDef::FTyp_ShortDate);
			pTable->AddField(OLESTR("Received"), FieldDef::FTyp_ShortDate);
			pTable->AddField(OLESTR("Account"), FieldDef::FTyp_Long);

			pTable->Open("C:\\mail", "a+b");
			pTable->Append();

			Table accounts;
			accounts.Open("C:\\accounts", "rb");

			int count = accounts.GetCount();

			for (int i = 0; i < count; i++)
			{
				Record* pRecord = accounts.GetRecord(i);
				Field* Server = pRecord->m_fields[1];
				Field* Username = pRecord->m_fields[2];
				Field* Password = pRecord->m_fields[3];

				MailAccount account;
				account.m_ID = pRecord->m_fields[0]->u.int32;
				account.m_server = std::string((char*)Server->GetData(), Server->GetSize());
				account.m_username = std::string((char*)Username->GetData(), Username->GetSize());
				account.m_password = std::string((char*)Password->GetData(), Password->GetSize());

				account.GetNewMail(pTable);
			}

			pTable->Close();
		}
#endif

#if 0
		{
			Table accounts;
			accounts.Open("C:\\news_accounts", "rb");

			/*
			int count = accounts.GetCount();

			for (int i = 0; i < count; i++)
			{
			*/
//.........这里部分代码省略.........
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:101,代码来源:MailReaderFrame.cpp


注:本文中的Table::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。