本文整理汇总了C++中ca函数的典型用法代码示例。如果您正苦于以下问题:C++ ca函数的具体用法?C++ ca怎么用?C++ ca使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ca函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ShortSave
/** Save a QPolygon to a stream in a shorter form. */
void ShortSave(QDataStream & s, const QPolygon& a)
{
//first, check if we _can_ do this the short way...
QRect bBox = a.boundingRect();
if (bBox.width() <= 254 && bBox.height() <= 254)
{
//qDebug("using 8 bits format");
//ok, we can do our own saving in 8 bits format to save space
s << (qint8) 1; //set flag to say we used this format :-)
QPoint topLeft = bBox.topLeft(); //get the coordinates of the top left of the box
s << topLeft;
QPolygon ca(a);
ca.translate(-topLeft.x(), -topLeft.y()); // translate the box so it's top left on (0,0)
//now, all points in the array fit into 16 bits!
s << (quint32) ca.count();
for (int i = 0; i < ca.count(); i++)
{
s << (quint8) ca.at(i).x();
s << (quint8) ca.at(i).y();
}
}
else if (bBox.width() < 65500 && bBox.height() < 65500)
{
//qDebug("using 16 bits format");
//ok, we can do our own saving in 16 bits format to save space
s << (qint8) 2; //set flag to say we used this format :-)
QPoint topLeft = bBox.topLeft(); //get the coordinates of the top left of the box
s << topLeft;
QPolygon ca(a);
ca.translate(-topLeft.x(), -topLeft.y()); // translate the box so it's top left on (0,0)
//now, all points in the array fit into 32 bits!
s << (quint32) ca.count();
for (int i = 0; i < ca.count(); i++)
{
s << (quint16) ca.at(i).x();
s << (quint16) ca.at(i).y();
}
}
else
{
//qDebug("using long 32 bits format.");
//too big. We need to use the normal 2x32 bits format :-(
s << (qint8) 4; //we need to set a flag that we use the normal format
s << a;
}
}
开发者ID:Exadios,项目名称:Cumulus,代码行数:50,代码来源:filetools.cpp
示例2: ca
LRESULT C_BranchProperties::OnColour(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
C_STLException::install();
try {
if (m_pBranch) {
C_ColourAreaPtr ca(m_pBranch);
if (ca) {
HWND wnd = reinterpret_cast<HWND>(lParam);
if (wnd == m_btnFill.m_hWnd) {
ca->put_FillColour(wParam);
if (m_pMap) {
m_pMap->RedrawAll();
}
}
/*else if (wnd == m_btnOutline.m_hWnd) {
ca->put_BorderColour(wParam);
}*/
}
}
}
catch (C_STLNonStackException const &exception) {
exception.Log(_T("Exception in C_BranchProperties::"));
}
return S_OK;
}
开发者ID:ElliottBignell,项目名称:HeadCase,代码行数:34,代码来源:BranchProperties.cpp
示例3: CONST_COMMITABLE_CAST
void MarkerStorage::generateMarkers(PCube fromCube, const Area* fromArea)
{
Context* context = Context::getContext();
CPDatabase db = CONST_COMMITABLE_CAST(Database, context->getParent(fromCube));
PEngineBase engine = context->getServer()->getEngine(EngineBase::CPU, false);
PCubeArea ca(new CubeArea(db, fromCube, *fromArea));
PArea area = ca->expandStar(CubeArea::BASE_ELEMENTS);
//go through string storage
PSourcePlanNode sn(new SourcePlanNode(fromCube->getStringStorageId(), area, fromCube->getObjectRevision()));
PProcessorBase cs = engine->createProcessor(sn, true);
while (cs->next()) {
addMarker(cs->getKey());
}
//go through numeric storage
sn.reset(new SourcePlanNode(fromCube->getNumericStorageId(), area, fromCube->getObjectRevision()));
cs = engine->createProcessor(sn, true);
while (cs->next()) {
addMarker(cs->getKey());
}
//go through marker storage
sn.reset(new SourcePlanNode(fromCube->getMarkerStorageId(), area, fromCube->getObjectRevision())); // TODO: -jj- right version object?
cs = engine->createProcessor(sn, true);
while (cs->next()) {
addMarker(cs->getKey());
}
//go through changedCells
PCellMapPlanNode cmpn(new CellMapPlanNode(fromCube->getMarkerStorageId(), area));
cs = engine->createProcessor(cmpn, true);
while (cs->next()) {
addMarker(cs->getKey());
}
}
开发者ID:Dalboz,项目名称:molap,代码行数:35,代码来源:MarkerStorage.cpp
示例4: TEST
/* ****************************************************************************
*
* check_json -
*/
TEST(ContextAttributeResponseVector, check_json)
{
ContextAttributeResponseVector carV;
ContextAttribute ca("caName", "caType", "caValue");
ContextAttributeResponse car;
std::string out;
const char* outfile1 = "ngsi10.contextAttributeResponse.check1.valid.json";
const char* outfile2 = "ngsi10.contextAttributeResponse.check2.valid.json";
ConnectionInfo ci(JSON);
// 1. ok
car.contextAttributeVector.push_back(&ca);
carV.push_back(&car);
out = carV.check(&ci, UpdateContextAttribute, "", "", 0);
EXPECT_STREQ("OK", out.c_str());
// 2. Predetected Error
out = carV.check(&ci, UpdateContextAttribute, "", "PRE ERROR", 0);
EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
EXPECT_STREQ(expectedBuf, out.c_str());
// 3. Bad ContextAttribute
ContextAttribute ca2("", "caType", "caValue");
car.contextAttributeVector.push_back(&ca2);
out = carV.check(&ci, UpdateContextAttribute, "", "", 0);
EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
EXPECT_STREQ(expectedBuf, out.c_str());
}
开发者ID:Fiware,项目名称:context.Orion,代码行数:34,代码来源:ContextAttributeResponseVector_test.cpp
示例5: check
static void check(const UString& dati_cert, const UString& dati_ca)
{
U_TRACE(5,"check(%p,%p)", &dati_cert, &dati_ca)
UCertificate c(dati_cert);
UCertificate ca(dati_ca);
UVector<UString> vec1, vec2;
(void) c.getCAIssuers(vec1);
(void) c.getRevocationURL(vec2);
cout << c << '\n'
<< c.isSelfSigned() << '\n'
<< c.isIssued(ca) << '\n'
<< c.getIssuer() << '\n'
// << c.getIssuerForLDAP() << '\n'
<< c.getSubject() << '\n'
<< c.getVersionNumber() << '\n'
<< c.getSerialNumber() << '\n'
<< c.hashCode() << '\n'
<< c.getNotBefore() << '\n'
<< c.getNotAfter() << '\n'
<< c.checkValidity() << '\n'
<< vec1 << '\n'
<< vec2 << '\n';
UString encoded = c.getEncoded("PEM");
/*
UFile::writeTo("certificate.encode", encoded);
U_ASSERT( dati_cert == encoded )
*/
}
开发者ID:psfu,项目名称:ULib,代码行数:34,代码来源:test_certificate.cpp
示例6: glog
// fuse::read
int AutoHttpFs::read(const char* path, char* buf, size_t size, off_t offset, struct fuse_file_info* ffi)
{
AutoHttpFsContext* ctx = AUTOHTTPFSCONTEXTS.find(ffi->fh);
glog(Log::DEBUG, ">> %s(%s) ffi=%p, fh=%"FINT64"d, ctx=%p, size=%"FINT64"d, offset=%"FINT64"d\n", \
__FUNCTION__, path, ffi, ffi->fh, ctx, (off_t)size, offset);
if(ffi->fh==0) return -EINVAL;
// for proc/.
if(ctx->proc) return ctx->proc->read(glog, buf, size, offset);
// for normal files.
UrlStat us;
int r = ctx->get_attr(glog, path, us);
if(r!=0) return r;
if(!us.is_reg()) return -EINVAL;
if((uint64_t)offset>=us.length) return 0;
if((uint64_t)offset+(uint64_t)size>=us.length) {
size = us.length - offset;
}
if(size<0) return 0;
CurlAccessor ca(path);
r = ca.get(glog, buf, offset, size);
if((r==200)||(r==206)) return size;
return -ENOENT;
}
开发者ID:suzumura-ss,项目名称:fuse-autohttpfs,代码行数:30,代码来源:autohttpfs.cpp
示例7: c
void tst_Q3CString::constructor()
{
Q3CString a;
Q3CString b; //b(10);
Q3CString c("String C");
char tmp[10];
tmp[0] = 'S';
tmp[1] = 't';
tmp[2] = 'r';
tmp[3] = 'i';
tmp[4] = 'n';
tmp[5] = 'g';
tmp[6] = ' ';
tmp[7] = 'D';
tmp[8] = 'X';
tmp[9] = '\0';
Q3CString d(tmp,9);
Q3CString ca(a);
Q3CString cb(b);
Q3CString cc(c);
QCOMPARE(a,ca);
QVERIFY(a.isNull());
QVERIFY(a == Q3CString(""));
QCOMPARE(b,cb);
QCOMPARE(c,cc);
QCOMPARE(d,(Q3CString)"String D");
Q3CString null(0);
QVERIFY( null.isNull() );
QVERIFY( null.isEmpty() );
Q3CString empty("");
QVERIFY( !empty.isNull() );
QVERIFY( empty.isEmpty() );
}
开发者ID:mpvader,项目名称:qt,代码行数:35,代码来源:tst_q3cstring.cpp
示例8: TEST
/* ****************************************************************************
*
* check_json -
*/
TEST(AppendContextElementResponse, check_json)
{
AppendContextElementResponse acer;
ContextAttributeResponse car;
ContextAttribute ca("", "TYPE", "VALUE"); // empty name, thus provoking error
std::string out;
const char* outfile1 = "ngsi10.appendContextElementRequest.check1.postponed.json";
const char* outfile2 = "ngsi10.appendContextElementRequest.check2.postponed.json";
ConnectionInfo ci;
utInit();
// 1. predetected error
ci.outMimeType = JSON;
out = acer.check(&ci, IndividualContextEntity, "", "PRE ERR", 0);
EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile1)) << "Error getting test data from '" << outfile1 << "'";
EXPECT_STREQ(expectedBuf, out.c_str());
// 2. bad contextAttributeResponseVector
car.contextAttributeVector.push_back(&ca);
acer.contextAttributeResponseVector.push_back(&car);
out = acer.check(&ci, IndividualContextEntity, "", "", 0);
EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), outfile2)) << "Error getting test data from '" << outfile2 << "'";
EXPECT_STREQ(expectedBuf, out.c_str());
// 3. OK
ca.name = "NAME";
out = acer.check(&ci, IndividualContextEntity, "", "", 0);
EXPECT_EQ("OK", out);
utExit();
}
开发者ID:Fiware,项目名称:context.Orion,代码行数:36,代码来源:AppendContextElementResponse_test.cpp
示例9: main
int main() {
ContoCorrente cc(1000);
cc.preleva(300);
cc.deposita(700);
ContoArancio ca(cc, 500);
ca.preleva(100);
}
开发者ID:fedsib,项目名称:pao_tests,代码行数:7,代码来源:esercizio_del_27-11-2015.cpp
示例10: main
int main(int argc, char *argv[])
{
if (argc == 2)
{
QCoreApplication ca(argc, argv);
if (ca.arguments().at(1) == "-s")
{
LsPaConnection(NULL).printDeviceList();
}
return 0;
}
QApplication a(argc, argv);
PaUtilRingBuffer rb;
char buffer[8 * 1024 * 16];
ring_buffer_size_t size = PaUtil_InitializeRingBuffer(&rb, 8, 1024 * 16, &buffer[0]);
Q_UNUSED(size);
PaUtil_FlushRingBuffer(&rb);
int ret = -1;
LsPaConnection connection(&rb);
Control control;
control.setPortAudioRec(&connection);
if (a.arguments().count() > 2)
{
bool ok = false;
int nr = a.arguments().at(1).toInt(&ok);
QString deviceName;
if ( ! ok )
{
deviceName = "Line 3/4 (M-Audio Delta 1010LT)[Windows WASAPI]";
}
else
{
deviceName = connection.getDeviceName(nr);
}
if (deviceName != "")
{
control.startRecording(deviceName, a.arguments().at(2));
}
ret = a.exec();
}
else
{
ThreatedServerSocket server(&control);
server.start();
ret = a.exec();
}
return ret;
}
开发者ID:audioprog,项目名称:parec,代码行数:60,代码来源:main.cpp
示例11: check
static void check(const UString& dati_crl, const UString& dati_ca)
{
U_TRACE(5,"check(%p,%p)", &dati_crl, &dati_ca)
// long revoked[10];
UCrl c(dati_crl);
UCertificate ca(dati_ca);
cout << c << "\n"
<< c.isUpToDate() << "\n"
<< c.getIssuer() << "\n"
<< c.isIssued(ca) << "\n"
<< c.getVersionNumber() << "\n"
<< c.getLastUpdate() << "\n"
// << c.getRevokedSerials(revoked, 10) << "\n"
<< c.getNextUpdate();
UString encoded = c.getEncoded("PEM");
/*
UFile::writeTo("crl.encode", encoded);
U_ASSERT( dati_crl == encoded )
*/
}
开发者ID:psfu,项目名称:ULib,代码行数:25,代码来源:test_crl.cpp
示例12: pSaveBtn
C4Network2ResDlg::ListItem::ListItem(C4Network2ResDlg *pForResDlg, const C4Network2Res *pByRes)
: pSaveBtn(NULL)
{
// init by res core (2do)
iResID = pByRes->getResID();
const char *szFilename = GetFilename(pByRes->getCore().getFileName());
// get size
int iIconSize = ::GraphicsResource.TextFont.GetLineHeight();
int iWidth = pForResDlg->GetItemWidth();
int iVerticalIndent = 2;
SetBounds(C4Rect(0, 0, iWidth, iIconSize+2*iVerticalIndent));
C4GUI::ComponentAligner ca(GetContainedClientRect(), 0,iVerticalIndent);
// create subcomponents
pFileIcon = new C4GUI::Icon(ca.GetFromLeft(iIconSize), C4GUI::Ico_Resource);
pLabel = new C4GUI::Label(szFilename, iIconSize + IconLabelSpacing,iVerticalIndent, ALeft);
pProgress = NULL;
// add components
AddElement(pFileIcon); AddElement(pLabel);
// tooltip
SetToolTip(LoadResStr("IDS_DESC_RESOURCE"));
// add to listbox (will eventually get moved)
pForResDlg->AddElement(this);
// first-time update
Update(pByRes);
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:25,代码来源:C4Network2ResDlg.cpp
示例13: Option
C4GameOptionsList::OptionDropdown::OptionDropdown(class C4GameOptionsList *pForDlg, const char *szCaption, bool fReadOnly)
: Option(pForDlg)
{
CStdFont &rUseFont = ::GraphicsResource.TextFont;
// get size of caption label
bool fTabular = pForDlg->IsTabular();
int32_t iCaptWidth, iCaptHeight;
if (fTabular)
{
// tabular layout: Caption label width by largest caption
rUseFont.GetTextExtent(LoadResStr("IDS_NET_RUNTIMEJOIN"), iCaptWidth, iCaptHeight, true);
iCaptWidth = iCaptWidth * 5 / 4;
}
else
{
rUseFont.GetTextExtent(szCaption, iCaptWidth, iCaptHeight, true);
}
// calc total height for component
int iHorizontalMargin = 1;
int iVerticalMargin = 1;
int iComboMargin = 5;
int iSelComboHgt = C4GUI::ComboBox::GetDefaultHeight();
SetBounds(C4Rect(0, 0, pForDlg->GetItemWidth(), (!fTabular) * (iCaptHeight + iVerticalMargin*2) + iVerticalMargin*2 + iSelComboHgt));
C4GUI::ComponentAligner ca(GetContainedClientRect(), iHorizontalMargin, iVerticalMargin);
// create subcomponents
AddElement(pCaption = new C4GUI::Label(FormatString("%s:", szCaption).getData(), fTabular ? ca.GetFromLeft(iCaptWidth, iCaptHeight) : ca.GetFromTop(iCaptHeight), ALeft));
ca.ExpandLeft(-iComboMargin);
AddElement(pPrimarySubcomponent = pDropdownList = new C4GUI::ComboBox(ca.GetAll()));
pDropdownList->SetReadOnly(fReadOnly);
pDropdownList->SetComboCB(new C4GUI::ComboBox_FillCallback<C4GameOptionsList::OptionDropdown>(this, &C4GameOptionsList::OptionDropdown::OnDropdownFill, &C4GameOptionsList::OptionDropdown::OnDropdownSelChange));
// final init
InitOption(pForDlg);
}
开发者ID:notprathap,项目名称:openclonk-5.4.1-src,代码行数:33,代码来源:C4GameOptions.cpp
示例14: ab
//頂点abcで作られたポリゴンから法線を計算
Vector3<float> ShadowScene::createPolygonNormal(Vector3<float> a, Vector3<float> b, Vector3<float> c) {
Vector3<float> ab( b - a );
Vector3<float> ca( c - a );
Vector3<float> normal = ab.cross(ca); //ab bcの外積
normal.normalize();//単位ベクトルにする
return normal;
}
开发者ID:kudolf,项目名称:Game,代码行数:9,代码来源:ShadowScene.cpp
示例15: ListItem
C4Network2ClientListBox::ClientListItem::ClientListItem(class C4Network2ClientListBox *pForDlg, int iClientID) // ctor
: ListItem(pForDlg, iClientID), pStatusIcon(nullptr), pName(nullptr), pPing(nullptr), pActivateBtn(nullptr), pKickBtn(nullptr), last_sound_time(0)
{
// get associated client
const C4Client *pClient = GetClient();
// get size
int iIconSize = ::GraphicsResource.TextFont.GetLineHeight();
if (pForDlg->IsStartup()) iIconSize *= 2;
int iWidth = pForDlg->GetItemWidth();
int iVerticalIndent = 2;
SetBounds(C4Rect(0, 0, iWidth, iIconSize+2*iVerticalIndent));
C4GUI::ComponentAligner ca(GetContainedClientRect(), 0,iVerticalIndent);
// create subcomponents
bool fIsHost = pClient && pClient->isHost();
pStatusIcon = new C4GUI::Icon(ca.GetFromLeft(iIconSize), fIsHost ? C4GUI::Ico_Host : C4GUI::Ico_Client);
StdStrBuf sNameLabel;
if (pClient)
{
if (pForDlg->IsStartup())
sNameLabel.Ref(pClient->getName());
else
sNameLabel.Format("%s:%s", pClient->getName(), pClient->getNick());
}
else
{
sNameLabel.Ref("???");
}
pName = new C4GUI::Label(sNameLabel.getData(), iIconSize + IconLabelSpacing,iVerticalIndent, ALeft);
int iPingRightPos = GetBounds().Wdt - IconLabelSpacing;
if (::Network.isHost()) iPingRightPos -= 48;
if (::Network.isHost() && pClient && !pClient->isHost())
{
// activate/deactivate and kick btns for clients at host
if (!pForDlg->IsStartup())
{
pActivateBtn = new C4GUI::CallbackButtonEx<C4Network2ClientListBox::ClientListItem, C4GUI::IconButton>(C4GUI::Ico_Active, GetToprightCornerRect(std::max(iIconSize, 16),std::max(iIconSize, 16),2,1,1), 0, this, &ClientListItem::OnButtonActivate);
fShownActive = true;
}
pKickBtn = new C4GUI::CallbackButtonEx<C4Network2ClientListBox::ClientListItem, C4GUI::IconButton>(C4GUI::Ico_Kick, GetToprightCornerRect(std::max(iIconSize, 16),std::max(iIconSize, 16),2,1,0), 0, this, &ClientListItem::OnButtonKick);
pKickBtn->SetToolTip(LoadResStrNoAmp("IDS_NET_KICKCLIENT"));
}
if (!pForDlg->IsStartup()) if (pClient && !pClient->isLocal())
{
// wait time
pPing = new C4GUI::Label("???", iPingRightPos, iVerticalIndent, ARight);
pPing->SetToolTip(LoadResStr("IDS_DESC_CONTROLWAITTIME"));
}
// add components
AddElement(pStatusIcon); AddElement(pName);
if (pPing) AddElement(pPing);
if (pActivateBtn) AddElement(pActivateBtn);
if (pKickBtn) AddElement(pKickBtn);
// add to listbox (will eventually get moved)
pForDlg->AddElement(this);
// first-time update
Update();
}
开发者ID:gitMarky,项目名称:openclonk,代码行数:57,代码来源:C4Network2Dialogs.cpp
示例16: recordedBP
Bst&
MeChart::
recordedBP(Item* itm, FullHist* h)
{
int subfv[MAXNUMFS];
getHt(h, subfv, TCALC);
CntxArray ca(subfv);
return itm->stored(ca);
}
开发者ID:KerstenDoering,项目名称:CPI-Pipeline,代码行数:9,代码来源:MeChart.C
示例17: main
int main()
{
int c = 3;
CA ca(1, 2, c);
ca.show();
getchar();
return 0;
}
开发者ID:wwlovepingping,项目名称:__Git,代码行数:10,代码来源:Main.cpp
示例18: DF1
static DF1(insert){PROLOG;A hs,*hv,z;I hn,j,k,m,n;
RZ(w);
m=IC(w); hs=VAV(self)->h; hn=AN(hs); hv=AAV(hs);
if(!m)R df1(w,iden(*hv));
j=n=MAX(hn,m-1);
RZ(z=AR(w)?from(sc(n%m),w):ca(w));
if(1==n)R z;
DO(n, --j; k=j%hn; RZ(z=(VAV(hv[k])->f2)(from(sc(j%m),w),z,hv[k])));
EPILOG(z);
}
开发者ID:zeotrope,项目名称:j7-src,代码行数:10,代码来源:cg.c
示例19: getThemeFromPropertyList
void WidgetThemeManager::applyCustomThemeOrAppearance(ThemedWidgetStateGeometry* geo, cefix::PropertyList* pl, const std::string subkey)
{
WidgetTheme* theme = getThemeFromPropertyList(pl);
if (pl->hasKey("customAppearance")) {
std::string ca(pl->get("customAppearance")->asString());
if (theme->hasDescription(ca))
theme->updateStateGeometry(geo, ca + subkey );
}
}
开发者ID:cefix,项目名称:cefix,代码行数:10,代码来源:WidgetThemeManager.cpp
示例20: putc
void putc(char c, unsigned int col, unsigned int row) {
// avoid black print bug
// unsigned char attr = getFormat(C_FG_WHITE, 0, C_BG_BLACK, 0);
u8 attr = currentFormat;
if (c == '\n') putc('\r', col, row);
ca (*p)[VIDEO_COLS] = (ca (*)[VIDEO_COLS]) VIDEO;
p[row][col].c = c;
p[row][col].a = attr;
}
开发者ID:agusaldasoro,项目名称:orga2,代码行数:11,代码来源:util.c
注:本文中的ca函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论