Beispiel #1
0
unsigned short LoadPGM( FILE * fi, Image * img ) {

	char magic[3];

	getMagic( fi, magic, sizeof(magic) );

	if ( !magic[0] ) return 0;

	img->magic[0] = magic[0];
	img->magic[1] = magic[1];


	char last;

	getComments( fi, img, &last );

	char width[100];
	getWidth( fi, width, sizeof(width), last );
	if ( !atoi(width) ) return 0;
	img->width = atoi(width);

	char height[100];
	getHeight( fi, height, sizeof(height) );
	if ( !atoi(height) ) return 0;
	img->height = atoi(height);

	char depth[100];
	getDepth( fi, depth, sizeof(depth) );
	if ( !atoi(depth) ) return 0;
	img->depth = atoi(depth);

	getData( fi, magic, img );

	return 1;
};
Beispiel #2
0
void DeckLoader::saveToStream_DeckHeader(QTextStream &out)
{
    if (!getName().isEmpty())
    {
        out << "// " << getName() << "\n\n";
    }

    if (!getComments().isEmpty())
    {
        QStringList commentRows = getComments().split(QRegExp("\n|\r\n|\r"));
        foreach(QString row, commentRows)
        {
            out << "// " << row << "\n";
        }
        out << "\n";
    }
void FbCommentManager::apiCommentsRemove(API::Comments::Remove *method) {

    qDebug() << "Removed Comment";
    delete method;
    getComments();

}
void FbCommentManager::apiStreamRemoveComment(API::Stream::RemoveComment *method) {

    qDebug() << "Removed Comment";
    delete method;
    getComments();

}
Beispiel #5
0
Tab* getComment(int id) {
	char query[1024];
	sprintf(query, "SELECT user, body, rating, date, indent, id"
		" FROM comments"
		" WHERE id = %i",
		id);
	return getComments(query, true);
}
void FbCommentManager::apiCommentsAdd(API::Comments::Add *method) {
    qDebug() << "Added Comment";
    m_commentEdit->clear();
    m_addCommentButton->setEnabled(true);
    delete method;
    getComments();

}
Beispiel #7
0
Tab* getComments(const char* type, int id) {
	char query[1024];
	sprintf(query, "SELECT user, body, rating, date, indent, id"
		" FROM comments"
		" INNER JOIN %s_comments on commentId = id"
		" WHERE %s_comments.entry = %i",
		type, type, id);
	return getComments(query, false);
}
Beispiel #8
0
//-------------------------------------------------------------------------------
///convenience member for quickly creating an annotation
void pMolLayer::annotate(const QString &name, const QString &comment, int index, int length)
{
    pMolAnnotation* annotation = new pMolAnnotation();
    annotation->pMolParent = this;
    annotation->setIndex(index);
    annotation->setLength(length);
    annotation->name = name;
    annotation->addComment(getComments());
    pMolElements.append(annotation);
};
Beispiel #9
0
//-------------------------------------------------------------------------------------------------------------
///Makes a deep copy
pMolElement* pMolLayer::duplicate()
{
  pMolLayer* layer = new pMolLayer();	
  layer->name=name;
  layer->setLength(length);
  layer->setIndex(index);
  layer->addComment(getComments());

  foreach (pMolElement* element, pMolElements)
    layer->append(element->duplicate());

  return (pMolElement*) layer;
};
Beispiel #10
0
int FBConnect::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: start(); break;
        case 1: stop(); break;
        case 2: sessionDidLogin((*reinterpret_cast< FBUID(*)>(_a[1]))); break;
        case 3: getFriendList(); break;
        case 4: getNewsFeed(); break;
        case 5: getAlbums((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 6: getOwnAlbums(); break;
        case 7: getComments((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 8: getPhotos((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 9: updateStatus((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 10: sendComment((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 11: test((*reinterpret_cast< const FBError(*)>(_a[1]))); break;
        case 12: update(); break;
        case 13: logout(); break;
        case 14: friendRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 15: newsFeedRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 16: albumRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 17: photosRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 18: commentRequestDidLoad((*reinterpret_cast< const QVariant(*)>(_a[1]))); break;
        case 19: sessionDidLogout(); break;
        case 20: gotPermissions(); break;
        case 21: { bool _r = getName();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        default: ;
        }
        _id -= 22;
    }
    return _id;
}
Beispiel #11
0
void ServerController::processClient(sf::Packet &packet, sf::TcpSocket &client)
{
	std::string protocol;
		
	packet >> protocol;
		
	std::cout << "Interpreting Packet Protocol: " << protocol << std::endl;
		
	if(protocol=="LOGIN"){
		loginAccount(packet, client);
	}
	else if(protocol=="REGISTER"){
		registerAccount(packet, client);
	}
	else if(protocol=="CONFERENCE_LIST"){
		getConferences(packet, client);
	}
	else if(protocol=="CONFERENCE_ACCESS"){
		getAccess(packet, client);
	}
	else if(protocol=="VIEW_SUBMISSIONS"){
		getSubmissions(packet, client);
	}
	else if(protocol=="SUBMIT_PAPER"){
		paperSubmission(packet, client);
	}
	else if (protocol=="ADMIN_STATUS"){
		getAdminStatus(packet, client);
	}
	else if (protocol=="CREATE_CONFERENCE"){
		createConference(packet, client);
	}
	else if (protocol=="GET_NOTIFICATIONS"){
		getNotifications(packet, client);
	}
	else if (protocol=="CHECK_PHASE"){
		checkPhase(packet, client);
	}
	else if (protocol=="BID_LIST"){
		bidList(packet, client);
	}
	else if (protocol=="BID_PAPER"){
		bidPaper(packet, client);
	}
	else if (protocol=="ADVANCE_PHASE"){
		advancePhase(packet, client);
	}
	else if(protocol=="BYE"){
		logoutUser(packet, client);
	}
	else if(protocol=="GET_ALLOCATIONS"){
		getAllocations(packet, client);
	}
	else if(protocol=="CONFERENCE_SUBMISSIONS"){
		getConferenceSubs(packet, client);
	}
	else if(protocol=="REVIEW_LIST"){
		getReviewList(packet, client, true);
	}
	else if (protocol=="SUB_DETAIL"){
		sendSubDetail(packet, client);
	}
	else if (protocol=="SUBMIT_REVIEW"){
		submitReview(packet, client);
	}
	else if (protocol=="GET_COMMENTS"){
		getComments(packet, client);
	}
	else if (protocol=="SEND_COMMENT"){
		sendComments(packet, client);
	}
	else if (protocol=="ADD_REVIEWER"){
		addMember(packet, client, Account::Access_Reviewer);
	}
	else if (protocol=="ADD_AUTHOR"){
		addMember(packet, client, Account::Access_Author);
	}
	else if (protocol=="CHANGE_MAX_ALLOCATED_CONF"){
		changeLimit(packet, client, "ALLOCATED");
	}
	else if (protocol=="CHANGE_MAX_PAPERREVIEWERS_CONF"){
		changeLimit(packet, client, "PAPERREV");
	}
	else if (protocol=="GET_MAX_ALLOCATED_CONF"){
		getLimit(packet, client, "ALLOCATED");
	}
	else if (protocol=="GET_MAX_PAPERREVIEWERS_CONF"){
		getLimit(packet, client, "PAPERREV");
	}
	else if (protocol=="GET_FULLNAME"){
		getAccountName(packet, client);
	}
	else if (protocol=="VIEW_REVIEW"){
		getReview(packet, client);
	}
	else if (protocol=="NOTIFY_COUNT"){
		checkNotifyCount(packet, client);
	}
	else if (protocol=="APPROVE_PAPER"){
		decidePaper(packet, client, true);
	}
	else if (protocol=="REJECT_PAPER"){
		decidePaper(packet, client, false);
	}
	else if (protocol=="MY_REVIEWS"){
		getReviewList(packet, client, false);
	}
	else if (protocol=="DID_REVIEW"){
		checkReviewed(packet, client);
	}
	else if (protocol=="FINAL_REVIEW"){
		getFinalReview(packet, client);
	}
	else if (protocol=="CONF_REVIEWERS"){
		getReviewers(packet, client);
	}
	else if (protocol=="CONF_SUBMISSIONS"){
		getConfSubmissions(packet, client);
	}
	else if (protocol=="FILLED_ALLOCATION"){
		checkPaperAlloc(packet, client);
	}
	else if (protocol=="GET_FREE_REVIEWERS"){
		getFreeReviewers(packet, client);
	}
	else if (protocol=="ASSIGN_REVIEWER"){
		assignReviewer(packet, client);
	}
	else if (protocol=="CHANGE_PASSWORD"){
		changePassword(packet, client);
	}
	else {
		std::cout << "Unrecognised protocol" << std::endl;
	}
}