Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Anonymous User
Let’s get started with Assignment 3 colleagues September 01, 2011 04:25PM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 01, 2011 04:28PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 02, 2011 10:49AM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 02, 2011 01:46PM |
Registered: 16 years ago Posts: 423 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 07, 2011 12:31PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 08, 2011 03:55PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 09, 2011 02:40PM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 09, 2011 06:31PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Language: C++ (QT)class Person{ public: QString name; QString surname; }; QString serialise(Person const &person){ return person.name + person.surname; } Person deserialise(QString const &serialData){ // ??? }
Language: C++ (QT)QString serialise(Person const &person){ return person.name + ';\t'; + person.surname; } Person deserialise(QString const &serialData){ QStringList fields = serialData.split(';\t';); Person person; person.name = fields[0]; person.surname = fields[1]; return person; }
Re: Let’s get started with Assignment 3 colleagues September 09, 2011 09:53PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 09, 2011 11:14PM |
Rating: 0 |
Language: C++ (QT)class TextBookReader{ public: friend TextBookReader& operator>>(TextBookReader& ter, Textbook cl); TextBookReader(QString fileName); bool read(textBookReader& cl); private: QString fn; }; TextBookReader cpp file [code="cpp-qt"] TextBookReader& operator>>(TextBookReader& reader, Textbook& cl) reader.read(cl); return reader; } TextBookReader::TextBookReader(QString n){ fn = n; } bool TextBookReader::read(TextbookMap &cl){ QFile fl(fn) fl.open(QIODevice::ReadOnly); QTextStream out(&fl); while (!fl.atEnd()){ QStringList list = line.split("/t";); ? ? ? } } fl.close return true; } so what I really want is this TextBookReader object to read a list from a file
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 09, 2011 11:39PM |
Rating: 0 |
Language: C++ (QT)Textbook(QString title, QString author, QString isbn, unit yearPub);
Re: Let’s get started with Assignment 3 colleagues September 10, 2011 10:22AM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Quote
Specre
On the other hand, when I try to compile a program (Example 11.4 and 11.5), I always get these errors - "cannot find - lcards2" and "collect2: Id returned 1 exit status". Tutorial letter 102's so useless
You have told the line to split wherever it finds the two character string of a forward slash followed by a lower-case t. This is not what I meant in my previous post.Language: C++ (QT)QStringList list = line.split("/t";);
Which is subtly different. Firstly, I've used the single character syntax of a backward slash followed by a lower-case t. This escape sequence represents the single Horizontal Tab character. You've used escape sequences before when sending text to the console. You use the newline escape sequence '\n' to move to the next line. Note, I used single quotes, not double quotes. This indicates that I am designating a single character and not a character string.Language: C++ (QT)QStringList list = line.split(';\t';);
Language: C++"Design Patterns, Gamma, 0099886, 1999\nProject Management, Crunx,98875, 2009\nOperating system, Wayne rooney,67534, 2011\n"
This is obviously undesirable so it would make more sense to split by record delimiter first.Language: C++"Design Patterns" " Gamma" " 0099886" " 1999\nProject Management" " Crunx" "98875" " 2009\nOperating system" " Wayne rooney" "67534" " 2011\n"
From this point you have individual serialised records that you can split into fields and create your data objects that you can then add to your container.Language: C++"Design Patterns, Gamma, 0099886, 1999" "Project Management, Crunx,98875, 2009" "Operating system, Wayne rooney,67534, 2011" ""
This will produce, the desired number of records, none of them empty:Language: C++ (QT)QStringList records = fileData.split(';\n';, QString::SkipEmptyParts);
Language: C++"Design Patterns, Gamma, 0099886, 1999" "Project Management, Crunx,98875, 2009" "Operating system, Wayne rooney,67534, 2011"
Re: Let’s get started with Assignment 3 colleagues September 11, 2011 12:31PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 11, 2011 06:03PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Language: C++ (QT)TEMPLATE = app LIBS += -L$$(CPPLIBS) \ -lutils \ -lcards2 # Input HEADERS += cardtable.h \ cardpics.h SOURCES += boxes.cpp \ cardtable.cpp \ cardpics.cpp RESOURCES = \ cards2.qrc
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 11, 2011 06:24PM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 11, 2011 06:26PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
LIBS += -L$$(CPPLIBS) \ -lutils \ -lcards2The line for linking in a static library called cards2.a? Does this file actually exist? Are you not making a mistake here? Do you understand what a static library is and what it's for? What's in the cards2.a library that you need in your project?
Re: Let’s get started with Assignment 3 colleagues September 11, 2011 07:01PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 11:35AM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 11:59AM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 12:28PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 12:55PM |
Registered: 18 years ago Posts: 1,424 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 01:13PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 02:34PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 04:48PM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 10:51PM |
Rating: 0 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 12, 2011 11:02PM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 13, 2011 09:34AM |
Registered: 12 years ago Posts: 43 Rating: 0 |
Anonymous User
Re: Let’s get started with Assignment 3 colleagues September 13, 2011 11:51AM |
Rating: 0 |
Re: Let’s get started with Assignment 3 colleagues September 13, 2011 01:43PM |
Registered: 15 years ago Posts: 3,496 Rating: 1 |
Re: Let’s get started with Assignment 3 colleagues September 13, 2011 04:30PM |
Registered: 12 years ago Posts: 43 Rating: 0 |