Example #1
0
int main(){
 
  Usuario user1("fuken1",1111,1),user2("fuken2",2222,1),
  user3("fuken3",3333,0),user4("fuken4",4444,0),
  usr5("",0,4);
  
  data_base db;
  int exito, exito2;
  
  exito = db.guardar_datos_usuario(user1);
  exito2 = db.guardar_datos_usuario(user3);
  cout << exito << endl;
  cout << exito2 <<endl;

  //db.guardar_datos_usuario(user2,"Estudiante");
  //db.guardar_datos_usuario(user3,"monitor");
  //db.guardar_datos_usuario(user4,"Monitor");
  //usr5 = db.cargar_datos_usuario(1111,"estudiante");
  //cout << usr5.get_name() << endl;
  //cout << usr5.get_id() << endl;
  //cout << usr5.get_rol() << endl;
  
  
  return 0;
}
Example #2
0
void TestKoGenStyles:: testUserStyles()
{
    kDebug() ;
    /* Two user styles with exactly the same attributes+properties will not get merged, since
     * they don't have exactly the same attributes after all: the display-name obviously differs :)
     */
    KOdfGenericStyles coll;

    KOdfGenericStyle user1(KOdfGenericStyle::ParagraphStyle, "paragraph");
    user1.addAttribute("style:display-name", "User 1");
    user1.addProperty("myfont", "isBold");

    QString user1StyleName = coll.insert(user1, "User1", KOdfGenericStyles::DontAddNumberToName);
    kDebug() << "The user style got assigned the name" << user1StyleName;
    QCOMPARE(user1StyleName, QString("User1"));

    KOdfGenericStyle user2(KOdfGenericStyle::ParagraphStyle, "paragraph");
    user2.addAttribute("style:display-name", "User 2");
    user2.addProperty("myfont", "isBold");

    QString user2StyleName = coll.insert(user2, "User2", KOdfGenericStyles::DontAddNumberToName);
    kDebug() << "The user style got assigned the name" << user2StyleName;
    QCOMPARE(user2StyleName, QString("User2"));

    // And now, what if the data uses that style?
    // This is like sameAsParent in the other test, but this time the
    // parent is a STYLE_USER...
    KOdfGenericStyle dataStyle(KOdfGenericStyle::ParagraphAutoStyle, "paragraph", user2StyleName);
    dataStyle.addProperty("myfont", "isBold");

    QString dataStyleName = coll.insert(dataStyle, "DataStyle");
    kDebug() << "The auto style got assigned the name" << dataStyleName;
    QCOMPARE(dataStyleName, QString("User2"));     // it found the parent as equal

    // Let's do the opposite test, just to make sure
    KOdfGenericStyle dataStyle2(KOdfGenericStyle::ParagraphAutoStyle, "paragraph", user2StyleName);
    dataStyle2.addProperty("myfont", "isNotBold");

    QString dataStyle2Name = coll.insert(dataStyle2, "DataStyle");
    kDebug() << "The different auto style got assigned the name" << dataStyle2Name;
    QCOMPARE(dataStyle2Name, QString("DataStyle1"));

    QCOMPARE(coll.styles().count(), 3);

    // XML for user style 1
    TEST_BEGIN(0, 0);
    user1.writeStyle(&writer, coll, "style:style", user1StyleName, "style:paragraph-properties");
    TEST_END_QTTEST("<r>\n <style:style style:name=\"User1\" style:display-name=\"User 1\" style:family=\"paragraph\">\n  <style:paragraph-properties myfont=\"isBold\"/>\n </style:style>\n</r>\n");

    // XML for user style 2
    TEST_BEGIN(0, 0);
    user2.writeStyle(&writer, coll, "style:style", user2StyleName, "style:paragraph-properties");
    TEST_END_QTTEST("<r>\n <style:style style:name=\"User2\" style:display-name=\"User 2\" style:family=\"paragraph\">\n  <style:paragraph-properties myfont=\"isBold\"/>\n </style:style>\n</r>\n");
}
Example #3
0
void CLogTrigger::EndTrigger(const void *pBody,
                             int nLen,
                             CAvenueMsgHandler *pHandler,
                             SLogInfo &sLog,
                             const map<string, vector<string> >* mapDefValue)
{
    if (sLog.isBNB)
    {
        if (sLog.pItem->nResSize == 0 )
        {        
            BuildLogInfo(sLog, "NULL");
            return;
        }
        string strRes[2];
        if (nLen > 0)
        {        
            pHandler->Decode(pBody, nLen);     
            vecTriggerItem user1(sLog.pItem->vecRes.begin(), sLog.pItem->vecRes.begin()+sLog.pItem->nResSize/2);
            vecTriggerItem user2(sLog.pItem->vecRes.begin()+sLog.pItem->nResSize/2, sLog.pItem->vecRes.end());
            strRes[0] = BuildLog(pHandler, mapDefValue, user1, sLog.mapKey);
            strRes[1] = BuildLog(pHandler, mapDefValue, user2, sLog.mapKey2);
        }
        else
        {        
            strRes[0] = GetDefaultValue(sLog.pItem->nResSize);
            strRes[1] = strRes[0];
        }
        BuildLogInfo(sLog, strRes[0]);
        char szBuf[MAX_LOG_BUFFER];
        snprintf(szBuf, sizeof(szBuf)-1, 
            "%s,  %s,  %s,  %s,  %s,  %s", 
            ASC_VERSION, sLog.mapKey2[1].c_str(), sLog.mapKey2[2].c_str(), sLog.mapKey2[3].c_str(),
            sLog.strReq[1].c_str(), strRes[1].c_str());
        sLog.plusLogInfo = szBuf;
    }
    else
    {
        string strRes;

        if (nLen > 0)
        {        
			SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s xxx\n",__FUNCTION__);
            pHandler->Decode(pBody, nLen);  
			if (pHandler!=NULL)
			{
				strRes = BuildLog(pHandler, mapDefValue, sLog.pItem->vecRes, sLog.mapKey);
				SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s %d value[%s]\n",__FUNCTION__,sLog.pItem->vecRes.size(),strRes.c_str());
			}			
        }

        BuildLogInfo(sLog, strRes);
    }
}
int main(int argc, char *argv[])
{
  while(1) 
  {
    if (argc > 1) 
    {
      user2(argv[1]);	
    }
    else
      user1();
  }
  return(0);
}
void tst_QPlaceUser::constructorTest()
{
    QPlaceUser user;
    QVERIFY(user.name().isEmpty());
    QVERIFY(user.userId().isEmpty());

    user.setName(QLatin1String("Thomas Anderson"));
    user.setUserId(QLatin1String("Neo"));

    QPlaceUser user2(user);
    QCOMPARE(user2.name(), QLatin1String("Thomas Anderson"));
    QCOMPARE(user2.userId(), QLatin1String("Neo"));
}
Example #6
0
void showError(IMP, char *course, char *where, char *desc)
{
    register char *p;

    p = course;
    userNL(IS);
    user2(IS, course, "\n");
    while (p != where)
    {
        userSp(IS);
        p += sizeof(char);
    }
    user(IS, "^\n");
    user3(IS, "Error: ", desc, "\n");
}
Example #7
0
void CLogTrigger::BeginTrigger(CAvenueMsgHandler *pHandler, int nServId, int nMsgId, SLogInfo& sInfo)
{    
    sInfo.pItem = CTriggerConfig::Instance()->GetInfo(TRIGGERTYPE,nServId, nMsgId);
    if (sInfo.pItem != NULL && sInfo.pItem->nReqSize > 0)
    {
        if (nServId == BNB_SERVICEID)
        {
            sInfo.isBNB = true;
            vecTriggerItem user1(sInfo.pItem->vecReq.begin(), sInfo.pItem->vecReq.begin()+sInfo.pItem->nReqSize/2);
            vecTriggerItem user2(sInfo.pItem->vecReq.begin()+sInfo.pItem->nReqSize/2, sInfo.pItem->vecReq.end());
            sInfo.strReq[0] = BuildLog(pHandler, NULL, user1, sInfo.mapKey);
            sInfo.strReq[1] = BuildLog(pHandler, NULL, user2, sInfo.mapKey2);
        }
        else
        {
            sInfo.strReq[0] = BuildLog(pHandler, NULL, sInfo.pItem->vecReq, sInfo.mapKey);
        }
    }
    SS_XLOG(XLOG_DEBUG,"CLogTrigger::%s service[%d],msg[%d] value[%s]\n",
            __FUNCTION__,nServId, nMsgId,sInfo.strReq[0].c_str());
}