示例#1
0
void XMLParserTest::initTestCase(){
    xmlParser = new XMLParser();
    QString path = QString("%1/%2").arg(StandardPaths::writeableLocation());
    QFile file(":/testData/transportations.xml");
    if(file.open(QIODevice::ReadOnly)){
        if(file.copy(path.arg("transportations.xml")))
            QFile::setPermissions(path.arg("transportations.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file.close();

    QFile file2(":/testData/equipments.xml");
    if(file2.open(QIODevice::ReadOnly)){
        if(file2.copy(path.arg("equipments.xml")))
            QFile::setPermissions(path.arg("equipments.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file2.close();

    QFile file3(":/testData/products.xml");
    if(file3.open(QIODevice::ReadOnly)){
        if(file3.copy(path.arg("products.xml")))
            QFile::setPermissions(path.arg("products.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file3.close();

    QFile file4(":/testData/employees.xml");
    if(file4.open(QIODevice::ReadOnly)){
        if(file4.copy(path.arg("employees.xml")))
            QFile::setPermissions(path.arg("employees.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file4.close();

    QFile file5(":/testData/workplaces.xml");
    if(file5.open(QIODevice::ReadOnly)){
        if(file5.copy(path.arg("workplaces.xml")))
            QFile::setPermissions(path.arg("workplaces.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file5.close();

    QFile file6(":/testData/workprocesslists.xml");
    if(file6.open(QIODevice::ReadOnly)){
        if(file6.copy(path.arg("workprocesslists.xml")))
            QFile::setPermissions(path.arg("workprocesslists.xml"), QFile::WriteOwner | QFile::ReadOwner);
    }
    file6.close();

}
示例#2
0
void ThroughPut::InputManagement(){
    //QFile file("datain.txt");
    QFile file0("./Pilot_send_data/pilot_1200_im.txt");
    if (!file0.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << file0.errorString();
        qDebug() << "Last sentence is in QPSK Inputmanagement." << endl;

    }
    //qDebug() << QObject::tr("file text:") << endl << file.readAll();
    //char str[100];
    char str6[100];
    for( int i = 0 ; i < 1200 ; i++ ){
        file0.readLine(str6,100);
        double crr = 0;
        crr = char2int(str6);
        //qDebug() << "pilot2[ "<< i <<"][0] is :"<<crr;
        pilot2[i][1] = crr;
    }
  file0.close();

  QFile file5("./Pilot_send_data/pilot_1200_re.txt");
  if (!file5.open(QIODevice::ReadOnly | QIODevice::Text)){
      qDebug() << file5.errorString();
      qDebug() << "Last sentence is in QPSK Inputmanagement." << endl;

  }
  //qDebug() << QObject::tr("file text:") << endl << file.readAll();
  //char str[100];

  for( int i = 0 ; i < 1200 ; i++ ){
      file5.readLine(str6,100);
      double crr = 0;
      crr = char2int(str6);
      //qDebug() << "pilot2[ "<< i <<"][0] is :"<<crr;
      pilot2[i][0] = crr;
  }
file5.close();

    //QFile file("./pilot4_send_data/pilot4_1200_re.txt");
    QFile file("./16qam_data_new/data_im.txt");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << file.errorString();
        qDebug() << "Last sentence is in ThroughPut Inputmanagement." << endl;

    }
    //qDebug() << QObject::tr("file text:") << endl << file.readAll();
    //char str[100];
    char str[100];
    for( int i = 0 ; i < 1200 ; i++ ){
        file.readLine(str,100);
        double crr = 0;
        crr = char2int(str);
        //qDebug() << "pilot4[ "<< i <<"][0] is :"<<crr;
        pilot4[i][0] = crr;
    }

    //qDebug() << "last one is :"<< ThroughPut[9][0] ;
    file.close();

    //QFile file2("./pilot4_send_data/pilot4_1200_im.txt");
    QFile file2("./16qam_data_new/data_re.txt");
    if (!file2.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << file2.errorString();
        qDebug() << "Last sentence is in ThroughPut Inputmanagement." << endl;
    }
    //qDebug() << QObject::tr("file text:") << endl << file2.readAll();
    //char str[100];
    for( int i = 0 ; i < 1200 ; i++ ){
        file2.readLine(str,100);
        double crr = 0;
        crr = char2int(str);
        //qDebug() << "pilot4[ "<< i <<"][1] is :"<<crr;
        pilot4[i][1] = crr;
    }


    //qDebug() <<"apsk[0][0] is :"<< *(pdata) << endl;
    file2.close();


   // QFile file3("./16qam_data/data_re.txt");
    QFile file3("./16qam_data_new/data_re.txt");
    if (!file3.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << file3.errorString();
        qDebug() << "Last sentence is in ThroughPut Inputmanagement." << endl;

    }
    //qDebug() << QObject::tr("file text:") << endl << file.readAll();
    //char str[100];
    int cnt_2_500=0;
    for( int i = 0 ; i < 600 ; i++ ){
        file3.readLine(str,100);
        double crr = 0;
        if(i%6!=0){
        crr = char2double(str);
       // qDebug() << "re[ "<< i <<"][0] is :"<<crr;
        qam16_3[cnt_2_500][0] = crr;
        cnt_2_500++;
        }
    }

    //qDebug() << "last one is :"<< ThroughPut[9][0] ;
    file3.close();

   // QFile file4("./16qam_data/data_im.txt");
    QFile file4("./16qam_data_new/data_im.txt");
    if (!file4.open(QIODevice::ReadOnly | QIODevice::Text)){
        qDebug() << file4.errorString();
        qDebug() << "Last sentence is in ThroughPut Inputmanagement." << endl;

    }
    //qDebug() << QObject::tr("file text:") << endl << file.readAll();
    //char str[100];
    int cnt_2_500_2;
    for( int i = 0 ; i < 600 ; i++ ){
        file4.readLine(str,100);
        double crr = 0;
        if(i%6!=0){
        crr = char2double(str);
        //qDebug() << "im[ "<< i <<"][0] is :"<<crr;
        qam16_3[cnt_2_500_2][1] = crr;
        cnt_2_500_2++;
        }
    }

    //qDebug() << "last one is :"<< ThroughPut[9][0] ;
    file4.close();







}