コード例 #1
0
ファイル: MainWindow.cpp プロジェクト: dmlys/QtTools
void MainWindow::connectSignals()
{
	connect(m_assign1, &QPushButton::clicked, this, [this] { AssignData(*m_model); });
	connect(m_assign2, &QPushButton::clicked, this, [this] { AssignData(*m_viewModel1); });
	connect(m_assign3, &QPushButton::clicked, this, [this] { AssignData(*m_viewModel2); });

	connect(m_upsert1, &QPushButton::clicked, this, [this] { UpsertData(*m_model); });
	connect(m_upsert2, &QPushButton::clicked, this, [this] { UpsertData(*m_viewModel1); });
	connect(m_upsert3, &QPushButton::clicked, this, [this] { UpsertData(*m_viewModel2); });

	connect(m_clear1, &QPushButton::clicked, this, [this] { ClearData(*m_model); });
	connect(m_clear2, &QPushButton::clicked, this, [this] { ClearData(*m_viewModel1); });
	connect(m_clear3, &QPushButton::clicked, this, [this] { ClearData(*m_viewModel2); });
}
コード例 #2
0
ファイル: assignment.c プロジェクト: faumijk/felt
int asgn_op ( )
{
    descriptor *src;
    descriptor *dest;
    int		status;


    src  = pop ( );
    dest = top ( );
    src  = deref (src);


    if (!assignable (dest)) {
	TypeError ("cannot assign to", NULL, dest, NULL, F_False);
	RecycleData (src);
	return 1;
    }

    dest = deref (dest);
    src = CollapseMatrix (src);
    status = AssignData (dest, &src);
    RecycleData (src);
    D_Temp (dest) = F_False;

    return status;
}
コード例 #3
0
ファイル: Rendering.cpp プロジェクト: alexanderkunz/raindrop
void VBO::Validate()
{
    if (!IsValid)
    {
        glGenBuffers(1, &InternalVBO);
        AssignData(VboData);
        IsValid = true;
    }
}
コード例 #4
0
	cCustomBinaryData::cDataAndPos*		cCustomBinaryData::AddData(const wchar_t*e_strID,char*e_pData,int e_iDataLength)
	{
		cDataAndPos*l_pDataAndPos = m_DataAndPosVector.GetObject(e_strID);
		l_pDataAndPos = AssignData(l_pDataAndPos,e_pData,e_iDataLength);
		l_pDataAndPos->pData->pName->iSize = sizeof(wchar_t)*wcslen(e_strID);
		l_pDataAndPos->pData->pName->pData = (char*)new wchar_t[l_pDataAndPos->pData->pName->iSize];
		memcpy(l_pDataAndPos->pData->pName->pData,e_strID,l_pDataAndPos->pData->pName->iSize*sizeof(wchar_t));
		l_pDataAndPos->iLength += l_pDataAndPos->pData->pName->iSize;
		return l_pDataAndPos;		
	}
コード例 #5
0
	cCustomBinaryData::cDataAndPos*		cCustomBinaryData::AddData(int e_iID,char*e_pData,int e_iDataLength)
	{
		cDataAndPos*l_pDataAndPos = this->GetObject(e_iID);
		l_pDataAndPos = AssignData(l_pDataAndPos,e_pData,e_iDataLength);
		l_pDataAndPos->iID = e_iID;
		l_pDataAndPos->bKeepData = true;
		l_pDataAndPos->pData->pName->iSize = sizeof(int);
		l_pDataAndPos->pData->pName->pData = new char[sizeof(int)];
		memcpy(l_pDataAndPos->pData->pName->pData,&e_iID,sizeof(int));
		l_pDataAndPos->iLength += sizeof(int);
		return l_pDataAndPos;
	}
コード例 #6
0
ファイル: List.c プロジェクト: RandyGaul/GAM_150_SampleEngine
// Create a Node at front of a list and initialize data
Node *InsertFront( List *list, void *data, unsigned data_size )
{
  // Create our Node with initialized data fields
  Node *newNode = CreateNode( data_size );

  // Copy our data into the newNode's memory space
  AssignData( data, newNode, data_size );

  // Make newNode point to what head points at
  newNode->next = list->head.next;
  newNode->prev = &list->head;

  // Make head point to newNode
  list->head.next->prev = newNode;
  list->head.next = newNode;

  // Add one to the NodeCount
  ++list->NodeCount;

  return newNode;
}
コード例 #7
0
int gen_op ( )
{
    Matrix	a;
    Matrix	b;
    void       *ptr;
    descriptor *d;
    descriptor *v;
    descriptor *var;
    descriptor *index;
    descriptor *vector;
    descriptor	temp;
    double	value;
    Address	increment;
    Array	arr;
    int		fail;
    unsigned	offset;
    unsigned	i;
    unsigned	c;
    unsigned	r;


    index = ntop (0);
    vector = ntop (1);
    var = ntop (2);

    offset = fetch (pc ++).ival;


    if (D_Type (index) == T_Double) {
        if (!assignable (var)) {
            TypeError ("cannot assign to", NULL, var, NULL, F_False);
            return 1;
        }

        d = &temp;
        D_Type    (d) = T_Null;
        D_Temp    (d) = F_False;
        D_Trapped (d) = F_False;
        D_Pointer (d) = NULL;

        v = CoerceData (vector, T_Double);
        AssignData (d, &v);
        RecycleData (v);
        D_Temp (d) = F_False;

        d_printf ("d = %s %p\n", D_TypeName (d), D_Pointer (d));

        switch (D_Type (d)) {
        case T_Double:
        case T_Matrix:
        case T_Array:
        case T_Null:
            break;


        default:
            TypeError ("cannot index", NULL, d, NULL, F_False);
            return 1;
        }

        *vector = *d;

        D_Type (index) = T_Row;
        D_Row (index) = 0;
    }

    d_printf ("vector = %s %p\n", D_TypeName (vector), D_Pointer (vector));
    var = deref (var);
    fail = F_False;


    switch (D_Type (vector)) {
    case T_Double:
        if (D_Row (index) ++ == 0)
            AssignData (var, &vector);
        else
            fail = F_True;
        break;


    case T_Matrix:
        a = D_Matrix (vector);
        d = &temp;
        D_Temp	  (d) = F_False;
        D_Trapped (d) = F_False;

        if (Mrows (a) == 1) {
            if (++ D_Row (index) <= Mcols (a)) {
                D_Type   (d) = T_Double;
                D_Double (d) = &value;
                value = mdata (a, 1, D_Row (index));
                AssignData (var, &d);
            } else
                fail = F_True;

        } else if (Mcols (a) == 1) {
            if (++ D_Row (index) <= Mrows (a)) {
                D_Type   (d) = T_Double;
                D_Double (d) = &value;
                value = mdata (a, D_Row (index), 1);
                AssignData (var, &d);
            } else
                fail = F_True;

        } else {
            if (++ D_Row (index) <= Mcols (a)) {
                d_printf ("indexing matrix\n");
                r = Mrows (a);
                c = D_Row (index);

                FreeData (var);
                CreateData (var, NULL, NULL, T_Matrix, r, 1);
                D_Temp (var) = F_False;
                b = D_Matrix (var);

                for (i = 1; i <= r; i ++)
                    sdata (b, i, 1) = mdata (a, i, c);
            } else
                fail = F_True;
        }
        break;


    case T_Array:
        arr = D_Array (vector);
        d = &temp;

        if (++ D_Row (index) <= arr -> length) {
            increment = D_Row (index) * arr -> elt_size;
            ptr = (void *) ((char *) arr -> ptr + increment);

            D_Type    (d) = arr -> type;
            D_Temp    (d) = F_False;
            D_Trapped (d) = F_False;
            D_Pointer (d) = ptr;
            AssignData (var, &d);
        } else
            fail = F_True;
        break;


    case T_Null:
        fail = F_True;
        break;
    }


    /* After assignment the variable is certainly not temporary.  Its trapped
       status remains as before: if it was trapped then AssignData() called
       the trap handler which didn't change the status.  If it wasn't then
       AssignData() left the status alone. */

    D_Temp (var) = F_False;

    if (fail == F_True) {
        pop ( );
        FreeData (pop ( ));		/* free the privately owned vector */
        pop ( );

        d = push ( );
        D_Type	  (d) = T_Null;
        D_Temp	  (d) = F_False;
        D_Trapped (d) = F_False;
        D_Pointer (d) = NULL;

        pc += offset;
        d_printf ("failing\n");
    }

    return 0;
}
コード例 #8
0
ファイル: message.cpp プロジェクト: Dutch-Man/EventLoop
BinaryMessage::BinaryMessage(const char* data, uint32_t length, bool has_hdr) : Message(MessageType::BINARY) {
  AssignData(data, length, has_hdr);
  ResetHeader();
}
コード例 #9
0
ファイル: message.cpp プロジェクト: Dutch-Man/EventLoop
BinaryMessage::BinaryMessage(const std::string& data, bool has_hdr) : Message(MessageType::BINARY) {
  AssignData(data.data(), data.size(), has_hdr);
  ResetHeader();
}