/*! \brief Build the code that creates the control.
 *
 * \return void
 *
 */
void wxsLinearRegulator::OnBuildCreatingCode()
{
    switch(GetLanguage())
    {
        case wxsCPP:
        {
            AddHeader(_T("\"wx/KWIC/LinearRegulator.h\""), GetInfo().ClassName);
            Codef(_T("%C(%W,%I,%P,%S, %s);\n"), wxT("wxBORDER_NONE"));

            // Default range is 0-100.
            if(m_iRangeMin != 0 || m_iRangeMax != 100){
                Codef(_T("%ASetRangeVal(%d, %d);\n"), static_cast<int>(m_iRangeMin), static_cast<int>(m_iRangeMax));
            }
            if(!m_bHorizontal){
                Codef(_T("%ASetOrizDirection(false);\n"));
            }
            if(!m_bShowVal){
                Codef(_T("%AShowCurrent(false);\n"));
            }
            if(!m_bShowLimits){
                Codef(_T("%AShowLimits(false);\n"));
            }
            wxString ss = m_cdActiveBarColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetActiveBarColour(%s);\n"), ss.wx_str());
            ss = m_cdPassiveBarColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetPassiveBarColour(%s);\n"), ss.wx_str());
            ss = m_cdBorderColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetBorderColour(%s);\n"), ss.wx_str());
            ss = m_cdLimitTextColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetTxtLimitColour(%s);\n"), ss.wx_str());
            ss = m_cdValueTextColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetTxtValueColour(%s);\n"), ss.wx_str());
            ss = m_cdTagColour.BuildCode(GetCoderContext());
            if(!ss.IsEmpty()) Codef(_T("%ASetTagsColour(%s);\n"), ss.wx_str());
            for(size_t i = 0; i < m_arrTags.Count(); i++){
                TagDesc *Desc = m_arrTags[i];
                Codef(_T("\t%AAddTag(%d);\n"), Desc->val);
            }
            ss = GetCoderContext()->GetUniqueName(_T("LinearRegulatorFont"));
            wxString sFnt = m_fnt.BuildFontCode(ss, GetCoderContext());
            if(sFnt.Len() > 0)
            {
                Codef(_T("%s"), sFnt.wx_str());
                Codef(_T("%ASetTxtFont(%s);\n"), ss.wx_str());
            }
            // Value needs to be set after other params for correct display.
            if(m_iValue){
                Codef(_T("%ASetValue(%d);\n"), static_cast<int>(m_iValue));
            }

            BuildSetupWindowCode();
            break;
        }
        case wxsUnknownLanguage: // fall-through
        default:
            wxsCodeMarks::Unknown(_T("wxsLinearRegulator::OnBuildCreatingCode"), GetLanguage());
    }
}
Esempio n. 2
0
/*! \brief Create the dialogue.
 *
 * \return void
 *
 */
void wxsPrintDialog::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/printdlg.h>"),GetInfo().ClassName,hfInPCH);

            wxString sDataName = GetCoderContext()->GetUniqueName(_T("printDialogData"));
            AddDeclaration(wxString::Format(wxT("wxPrintDialogData  *%s;"), sDataName.wx_str()));
            Codef(_T("\t%s = new wxPrintDialogData;\n"), sDataName.wx_str());

            if(m_bEnableHelp){
                Codef(_T("\t%s->EnableHelp(%b);\n"), sDataName.wx_str(), m_bEnableHelp);
            }
            if(!m_bEnablePageNumbers){
                Codef(_T("\t%s->EnablePageNumbers(%b);\n"), sDataName.wx_str(), m_bEnablePageNumbers);
            }
            if(!m_bEnablePrintToFile){
                Codef(_T("\t%s->EnablePrintToFile(%b);\n"), sDataName.wx_str(), m_bEnablePrintToFile);
            }
            if(m_bEnableSelection){
                Codef(_T("\t%s->EnableSelection(%b);\n"), sDataName.wx_str(), m_bEnableSelection);
                if(m_bSelection){
                    Codef(_T("\t%s->SetSelection(%b);\n"), sDataName.wx_str(), m_bSelection);
                }
            }
            if(m_bCollate){
                Codef(_T("\t%s->SetCollate(%b);\n"), sDataName.wx_str(), m_bCollate);
            }
            if(m_iFromPage > 0){
                Codef(_T("\t%s->SetFromPage(%d);\n"), sDataName.wx_str(), m_iFromPage);
            }
            if(m_iToPage > 0){
                Codef(_T("\t%s->SetToPage(%d);\n"), sDataName.wx_str(), m_iToPage);
            }
            if(m_iMinPage > 0){
                Codef(_T("\t%s->SetMinPage(%d);\n"), sDataName.wx_str(), m_iMinPage);
            }
            if(m_iMaxPage > 0){
                Codef(_T("\t%s->SetMaxPage(%d);\n"), sDataName.wx_str(), m_iMaxPage);
            }
            if(m_iNoCopies > 1){
                Codef(_T("\t%s->SetNoCopies(%d);\n"), sDataName.wx_str(), m_iNoCopies);
            }

            Codef(_T("%C(%W, %v);\n"), sDataName.wx_str());
            BuildSetupWindowCode();
            return;
        }

        default:
        {
            wxsCodeMarks::Unknown(_T("wxsPrintDialog::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
/*************************************
 * AddHeader
 *************************************/
void SHVTestLoggerConsole::AddHeader(const SHVTChar* s, ...)
{
SHVString str;
	SHVVA_LIST args;
	SHVVA_START(args, s);
	str.FormatList(s,args);
	AddHeader(str);
	SHVVA_END(args);
}
Esempio n. 4
0
void wxsCalendarCtrl::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/calctrl.h>"),GetInfo().ClassName,0);
            AddHeader(_T("<wx/calctrl.h>"),_T("wxCalendarEvent"),0);
            Codef(_T("%C(%W, %I, wxDefaultDateTime, %P, %S, %T, %N);\n"));
            BuildSetupWindowCode();
            return;
        }

        default:
        {
            wxsCodeMarks::Unknown(_T("wxsCalendarCtrl::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
void wxsTimePickerCtrl::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/timectrl.h>"),GetInfo().ClassName,0);
            AddHeader(_T("<wx/dateevt.h>"),_T("wxDateEvent"),0);
            Codef(_T("%C(%W, %I, wxDateTime::Now(), %P, %S, %T, %V, %N);\n"));
            BuildSetupWindowCode();
            return;
        }

        default:
        {
            wxsCodeMarks::Unknown(_T("wxsTimePickerCtrl::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
Esempio n. 6
0
void *ProxyLogoff(struct mansession *s, struct message *m) {
	struct message mo;
	char *actionid = actionid = astman_get_header(m, "ActionID");
 
	memset(&mo, 0, sizeof(struct message));
	AddHeader(&mo, "Response: Goodbye");
	AddHeader(&mo, "Message: Thanks for all the fish.");
	if( actionid && strlen(actionid) > 0 )
		AddHeader(&mo, "ActionID: %s", actionid);
 
	s->output->write(s, &mo);
	FreeHeaders(&mo);

	destroy_session(s);
	if (debug)
		debugmsg("Client logged off - exiting thread");
	pthread_exit(NULL);
	return 0;
}
Esempio n. 7
0
void CFireView::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CFormView::OnShowWindow(bShow, nStatus);
	AddHeader(_T("Dest IP"));
	AddHeader(_T("Dest MASK"));
	AddHeader(_T("Dest PORT"));
	AddHeader(_T("Source IP"));
	AddHeader(_T("Source MASK"));
	AddHeader(_T("Source PORT"));
	AddHeader(_T("PROTOCOL"));
	AddHeader(_T("ACTION"));
}
Esempio n. 8
0
  void HttpOutput::StateMachine::SetCookie(const std::string& cookie,
                                           const std::string& value)
  {
    if (state_ != State_WritingHeader)
    {
      throw OrthancException(ErrorCode_BadSequenceOfCalls);
    }

    // TODO Escape "=" characters
    AddHeader("Set-Cookie", cookie + "=" + value);
  }
Esempio n. 9
0
void *ProxyListIOHandlers(struct mansession *s) {
	struct message m;
	struct iohandler *i;

	memset(&m, 0, sizeof(struct message));
	AddHeader(&m, "ProxyResponse: Success");

	i = iohandlers;
	while (i && (m.hdrcount < MAX_HEADERS - 1) ) {
		if (i->read)
			AddHeader(&m, "InputHandler: %s", i->formatname);
		if (i->write)
			AddHeader(&m, "OutputHandler: %s", i->formatname);
		i = i->next;
	}

	s->output->write(s, &m);
	FreeHeaders(&m);
	return 0;
}
Esempio n. 10
0
int ProxyAddServer(struct mansession *s, struct message *m) {
	struct message mo;
	struct ast_server *srv;
	int res = 0;

	/* malloc ourselves a server credentials structure */
	srv = malloc(sizeof(struct ast_server));
	if ( !srv ) {
		fprintf(stderr, "Failed to allocate server credentials: %s\n", strerror(errno));
		exit(1);
	}

	memset(srv, 0, sizeof(struct ast_server) );
	memset(&mo, 0, sizeof(struct message));
	strcpy(srv->ast_host, astman_get_header(m, "Server"));
	strcpy(srv->ast_user, astman_get_header(m, "Username"));
	strcpy(srv->ast_pass, astman_get_header(m, "Secret"));
	strcpy(srv->ast_port, astman_get_header(m, "Port"));
	strcpy(srv->ast_events, astman_get_header(m, "Events"));

	if (*srv->ast_host && *srv->ast_user && *srv->ast_pass && *srv->ast_port && *srv->ast_events) {
		pthread_mutex_lock(&serverlock);
		srv->next = pc.serverlist;
		pc.serverlist = srv;
		pthread_mutex_unlock(&serverlock);
		res = StartServer(srv);
	} else
		res = 1;

	if (res) {
		AddHeader(&mo, "ProxyResponse: Failure");
		AddHeader(&mo, "Message: Could not add %s", srv->ast_host);
	} else {
		AddHeader(&mo, "ProxyResponse: Success");
		AddHeader(&mo, "Message: Added %s", srv->ast_host);
	}

	s->output->write(s, &mo);
	FreeHeaders(&mo);
	return 0;
}
Esempio n. 11
0
int CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response)
{
  response = MHD_create_response_from_data(0, NULL, MHD_NO, MHD_NO);
  if (response == NULL)
  {
    CLog::Log(LOGERROR, "CWebServer: failed to create HTTP redirect response to %s", strURL.c_str());
    return MHD_NO;
  }

  AddHeader(response, MHD_HTTP_HEADER_LOCATION, strURL);
  return MHD_YES;
}
/*! \brief Create the initial control.
 *
 * \return void
 *
 */
void wxsImageList::OnBuildCreatingCode()
{
    int         i;
    wxString    inc;
    wxString    vname;  // this variable name
    wxString    bname;  // name of the bitmap variable
    wxString    fbase;  // base name of XPM file without dirs or extension
    wxString    fabs;   // absolute name of XPM file
    wxString    frel;   // relative
    wxString    dname;  // name of XPM data array
    wxBitmap    bmp;    // preview bitmap saved as XPM
    wxString    ss, tt; // general use

    // have we already been here?
    if(m_IsBuilt){
        return;
    }
    m_IsBuilt = true;

    switch(GetLanguage())
    {
        case wxsCPP:
            {
                AddHeader(_("<wx/imaglist.h>"), GetInfo().ClassName, 0);

                // store the XPM data someplace
                StoreXpmData();

                vname = GetVarName();
                // if there is no data, then just make empty image and bitmap
                if(m_Count == 0){
                    Codef(_T("%s = new wxImageList(%d, %d, 1);\n"), vname.wx_str(), m_Width, m_Height);
                }
                // else fill it with XPM data
                else{
                    Codef(_T("%s = new wxImageList(%d, %d, %d);\n"),  vname.wx_str(), m_Width, m_Height, (m_Count + 1));
                    for(i = 0; i < m_Count; i++) {
                        ss.Printf(_("%s_%d_XPM"), vname.wx_str(), i);
                        Codef(_T("%s->Add(wxBitmap(%s));\n"), vname.wx_str(), ss.wx_str());
                    }
                }

                BuildSetupWindowCode();
                return;
            }

        case wxsUnknownLanguage: // fall through
        default:
            {
                wxsCodeMarks::Unknown(_T("wxsImageList::OnBuildCreatingCode"), GetLanguage());
            }
    }
}
Esempio n. 13
0
int CWebServer::CreateRedirect(struct MHD_Connection *connection, const std::string &strURL, struct MHD_Response *&response) const
{
  response = create_response(0, nullptr, MHD_NO, MHD_NO);
  if (response == nullptr)
  {
    CLog::Log(LOGERROR, "CWebServer[%hu]: failed to create HTTP redirect response to %s", m_port, strURL.c_str());
    return MHD_NO;
  }

  AddHeader(response, MHD_HTTP_HEADER_LOCATION, strURL);
  return MHD_YES;
}
Esempio n. 14
0
bool CHTTPSock::Redirect(const CString& sURL) {
	if (SentHeader()) {
		DEBUG("Redirect() - Header was already sent");
		return false;
	}

	DEBUG("- Redirect to [" << sURL << "]");
	AddHeader("Location", sURL);
	PrintErrorPage(302, "Found", "The document has moved <a href=\"" + sURL.Escape_n(CString::EHTML) + "\">here</a>.");

	return true;
}
Esempio n. 15
0
void *ProxyListSessions(struct mansession *s) {
	struct message m;
	struct mansession *c;
	char iabuf[INET_ADDRSTRLEN];

	memset(&m, 0, sizeof(struct message));
	AddHeader(&m, "ProxyResponse: Success");

	pthread_rwlock_rdlock(&sessionlock);
	c = sessions;
	while (c && (m.hdrcount < MAX_HEADERS - 4) ) {
		if (!c->server) {
			AddHeader(&m, "ProxyClientSession: %s", ast_inet_ntoa(iabuf, sizeof(iabuf), c->sin.sin_addr));
			AddHeader(&m, "ProxyClientActionID: %s", c->actionid);
			AddHeader(&m, "ProxyClientInputHandler: %s", c->input->formatname);
			AddHeader(&m, "ProxyClientOutputHandler: %s", c->output->formatname);
		} else 
			AddHeader(&m, "ProxyServerSession: %s", ast_inet_ntoa(iabuf, sizeof(iabuf), c->sin.sin_addr));
		c = c->next;
	}
	pthread_rwlock_unlock(&sessionlock);

	s->output->write(s, &m);
	FreeHeaders(&m);
	return 0;
}
Esempio n. 16
0
bool TriAcePS1Seq::GetHeaderInfo(void) {
    SetPPQN(0x30);

    header = AddHeader(dwOffset, 0xD5);
    header->AddSimpleItem(dwOffset + 2, 2, L"Size");
    header->AddSimpleItem(dwOffset + 0xB, 4, L"Song title");
    header->AddSimpleItem(dwOffset + 0xF, 1, L"BPM");
    header->AddSimpleItem(dwOffset + 0x10, 2, L"Time Signature");

    unLength = GetShort(dwOffset + 2);
    AlwaysWriteInitialTempo(GetByte(dwOffset + 0xF));
    return true;
}
void wxsMultiChoiceDialog::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/choicdlg.h>"),GetInfo().ClassName,hfInPCH);

            wxString ChoicesName;
            if ( m_Content.GetCount() > 0 )
            {
                ChoicesName = GetCoderContext()->GetUniqueName(_T("__wxMultiChoiceDialogChoices"));
                #if wxCHECK_VERSION(2, 9, 0)
                Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.wx_str(),(int)m_Content.GetCount());
                #else
                Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.c_str(),(int)m_Content.GetCount());
                #endif
                for ( size_t i = 0; i < m_Content.GetCount(); ++i )
                {
                    #if wxCHECK_VERSION(2, 9, 0)
                    Codef(_T("\t%t%s\n"),m_Content[i].wx_str(),((i!=m_Content.GetCount()-1)?_T(","):_T("")));
                    #else
                    Codef(_T("\t%t%s\n"),m_Content[i].c_str(),((i!=m_Content.GetCount()-1)?_T(","):_T("")));
                    #endif
                }
                Codef(_T("};\n"));
            }

            Codef(_T("%C(%W, %t, %t, %d, %s, %T, %P);\n"),
                #if wxCHECK_VERSION(2, 9, 0)
                m_Message.wx_str(),
                m_Caption.wx_str(),
                (int)m_Content.GetCount(),
                (m_Content.IsEmpty()?_T("0"):ChoicesName.wx_str()));
                #else
                m_Message.c_str(),
                m_Caption.c_str(),
                (int)m_Content.GetCount(),
                (m_Content.IsEmpty()?_T("0"):ChoicesName.c_str()));
                #endif

            BuildSetupWindowCode();
            return;
        }

        default:
        {
            wxsCodeMarks::Unknown(_T("wxsMultiChoiceDialog::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
Esempio n. 18
0
void wxsAxis::OnBuildCreatingCode() {
    wxString    vname;
    wxString    pname;
    wxString    cname;
    wxString    fname;
    wxString    dtext;

// we only know C++ language

    if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsAxis::OnBuildCreatingCode"),GetLanguage());

// usefull names

    vname = GetVarName();
    pname = GetParent()->GetVarName();
    cname = vname + _("_PEN");
    fname = vname + _("_FONT");

// the header for mathplot

    AddHeader(_T("<mathplot.h>"),GetInfo().ClassName,hfInPCH);

// create the axis -- but not the setup code

    if (mType == 0) Codef(_T("%s = new mpScaleX(_(\"%s\"), %d, %b);\n"), vname.wx_str(), mLabel.wx_str(), mAlign, mTics);
    else            Codef(_T("%s = new mpScaleY(_(\"%s\"), %d, %b);\n"), vname.wx_str(), mLabel.wx_str(), mAlign, mTics);
//  BuildSetupWindowCode();

// assign a pen to the layer

    dtext = mPenColour.BuildCode(GetCoderContext());
    if (dtext.Len() > 0) {
        Codef(_T("wxPen   %s(%s);\n"), cname.wx_str(), dtext.wx_str());
        Codef(_T("%s->SetPen(%s);\n"), vname.wx_str(), cname.wx_str());
    };

// assign a font to the layer

    dtext = mPenFont.BuildFontCode(fname, GetCoderContext());
    if (dtext.Len() > 0) {
        Codef(_T("%s"), dtext.wx_str());
        Codef(_T("%s->SetFont(%s);\n"), vname.wx_str(), fname.wx_str());
    };

// add to parent window -- should be a mpWindow

    if ((GetPropertiesFlags() & flHidden) && GetBaseProps()->m_Hidden)
        ; // do nothing
    else
        Codef(_T("%s->AddLayer(%s);\n"), pname.wx_str(), vname.wx_str());
}
/*! \brief Create the dialogue.
 *
 * \return void
 *
 */
void wxsRichTextStyleOrganiserDialog::OnBuildCreatingCode()
{
	wxString sFlags;
	wxString sStyleSheetName = GetCoderContext()->GetUniqueName(_T("richTextStyleSheet"));
    switch(GetLanguage())
    {
        case wxsCPP:
            AddHeader(_T(" <wx/richtext/richtextstyledlg.h>"), GetInfo().ClassName, 0);

            for(int i = 0;arrStyleValueNames[i];i++){
                if(m_iFlags & arrStyleValues[i]){
                	sFlags << arrStyleValueNames[i] << _T("|");
                }
            }
			if(sFlags.IsEmpty()){
				sFlags = _T("0");
			}
            else{
				sFlags.RemoveLast();
            }

			#if wxCHECK_VERSION(2, 9, 0)
			AddDeclaration(wxString::Format(wxT("wxRichTextStyleSheet  *%s;"), sStyleSheetName.wx_str()));
            Codef(_T("\t%s = new wxRichTextStyleSheet;\n"), sStyleSheetName.wx_str());
			#else
			AddDeclaration(wxString::Format(wxT("wxRichTextStyleSheet  *%s;"), sStyleSheetName.c_str()));
            Codef(_T("\t%s = new wxRichTextStyleSheet;\n"), sStyleSheetName.c_str());
			#endif

			#if wxCHECK_VERSION(2, 9, 0)
            Codef(_T("%C(%s, %s, NULL, %W, %I, %t, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE);\n"),
							sFlags.wx_str(), sStyleSheetName.wx_str(), m_sCaption.wx_str());
			#else
            Codef(_T("%C(%s, %s, NULL, %W, %I, %t, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, ")
							wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE);\n"),
							sFlags.c_str(), sStyleSheetName.c_str(), m_sCaption.c_str());
			#endif

            BuildSetupWindowCode();
            break;

        default:
            wxsCodeMarks::Unknown(_T("wxsRichTextStyleOrganiserDialog::OnBuildCreatingCode"), GetLanguage());
    }
}
Esempio n. 20
0
int ProxyChallenge(struct mansession *s, struct message *m) {
	struct message mo;
	char *actionid;

	actionid = astman_get_header(m, "ActionID");
	if ( strcasecmp("MD5", astman_get_header(m, "AuthType")) ) {
		SendError(s, "Must specify AuthType", actionid);
		return 1;
	}

	if (!*s->challenge)
		snprintf(s->challenge, sizeof(s->challenge), "%d", rand());

	memset(&mo, 0, sizeof(struct message));
	AddHeader(&mo, "Response: Success");
	AddHeader(&mo, "Challenge: %s", s->challenge);
	if( actionid && strlen(actionid) )
		AddHeader(&mo, "ActionID: %s", actionid);

	s->output->write(s, &mo);
	FreeHeaders(&mo);
	return 0;
}
Esempio n. 21
0
void wxsCustomWidget::OnBuildCreatingCode()
{
    if ( GetCoderFlags() & flSource )
    {
        if ( !m_IncludeFile.IsEmpty() )
        {
            if ( m_IncludeIsLocal ) AddHeader(_T("\"") + m_IncludeFile + _T("\""), GetUserClass(), 0);
            else                    AddHeader(_T("<")  + m_IncludeFile + _T(">"),  GetUserClass(), 0);
        }
    }

    wxString Result = m_CreatingCode;
    Result.Replace(_T("$(POS)"),Codef(GetCoderContext(),_T("%P")));
    Result.Replace(_T("$(SIZE)"),Codef(GetCoderContext(),_T("%S")));
    Result.Replace(_T("$(STYLE)"),m_Style);
    Result.Replace(_T("$(ID)"),GetIdName());
    Result.Replace(_T("$(THIS)"),GetVarName());
    Result.Replace(_T("$(PARENT)"),GetCoderContext()->m_WindowParent);
    Result.Replace(_T("$(NAME)"),Codef(GetCoderContext(),_T("%N")));
    Result.Replace(_T("$(CLASS)"),GetUserClass());

    AddBuildingCode(Result+_T("\n"));
}
Esempio n. 22
0
void StatsInterface::HandleStmgrsRegistrationSummaryRequest(IncomingHTTPRequest* _request) {
  LOG(INFO) << "Request for stream managers registration summary " << _request->GetQuery();
  unsigned char* request_data =
    _request->ExtractFromPostData(0, _request->GetPayloadSize());
  heron::proto::tmaster::StmgrsRegistrationSummaryRequest stmgrs_reg_request;
  if (!stmgrs_reg_request.ParseFromArray(request_data, _request->GetPayloadSize())) {
    LOG(ERROR) << "Unable to deserialize post data specified in" <<
      "StmgrsRegistrationSummaryRequest" << std::endl;
    http_server_->SendErrorReply(_request, 400);
    delete _request;
    return;
  }
  auto stmgrs_reg_summary_response = tmaster_->GetStmgrsRegSummary();
  sp_string response_string;
  CHECK(stmgrs_reg_summary_response->SerializeToString(&response_string));
  auto http_response = new OutgoingHTTPResponse(_request);
  http_response->AddHeader("Content-Type", "application/octet-stream");
  http_response->AddHeader("Content-Length", std::to_string(response_string.size()));
  http_response->AddResponse(response_string);
  http_server_->SendReply(_request, 200, http_response);
  delete _request;
  LOG(INFO) << "Returned stream managers registration summary response";
}
void wxsSymbolPickerDialog::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
            AddHeader(_T("<wx/richtext/richtextsymboldlg.h>"),GetInfo().ClassName, 0);
            Codef(_T("%C( %t, %t, %t, %W, %I, %t, %P, %S, %T);\n"), _T(""), _T(""), _T(""), _T("Title") );
            BuildSetupWindowCode();
            break;

        default:
            wxsCodeMarks::Unknown(_T("wxsSymbolPickerDialog::OnBuildCreatingCode"),GetLanguage());
    }
}
/*! \brief Create the dialogue.
 *
 * \return void
 *
 */
void wxsPasswordEntryDialog::OnBuildCreatingCode()
{
    switch(GetLanguage())
    {
        case wxsCPP:
            AddHeader(_T("<wx/textdlg.h>"), GetInfo().ClassName, 0);
            Codef(_T("%C(%W, %t, %t, %t, %T, %P);\n"), m_sMessage.wx_str(), m_sCaption.wx_str(), m_sDefaultValue.wx_str());
            BuildSetupWindowCode();
            break;

        default:
            wxsCodeMarks::Unknown(_T("wxsPasswordEntryDialog::OnBuildCreatingCode"), GetLanguage());
    }
}
Esempio n. 25
0
void wxsBitmapComboBox::OnBuildCreatingCode() {
int         i,n;
wxString    ss, tt, vv;
bool        ilist;

// we only handle C++ constructs here

    if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsBitmapComboBox"),GetLanguage());

// header files

    AddHeader(_T("<wx/bmpcbox.h>"),GetInfo().ClassName,hfInPCH);

// the basic constructor

    vv = GetVarName();
    Codef(_T("%C(%W, %I, wxEmptyString, %P, %S, 0, NULL, %T, %V, %N);\n"));

// was a valid image-list specified?

    ilist = (wxsImageListEditorDlg::FindTool(this, mImageList) != NULL);

// add all text items, and the bitmaps at the bottom of the code
// bitmaps have to added after the wxsImages' and wxsImageList's were added
// note: first 2 items in mItems are used only in the dialog

    for(i=2; i<(int)mItems.GetCount(); ++i) {
        ss = mItems.Item(i);
        ParseComboItem(ss, tt, n);

// add the text item

        Codef(_T("%s->Append(_T(\"%s\"));\n"), vv.wx_str(), tt.wx_str());

// add the bitmap at the bottom of the code

        if ((ilist) && (n >= 0)) {
            tt.Printf(_T("%s->SetItemBitmap(%d, %s->GetBitmap(%d));\n"), vv.wx_str(), i-2, mImageList.wx_str(), n);
            AddEventCode(tt);
        };
    };

    AddEventCode(_T("\n"));

// finish setup

    BuildSetupWindowCode();

}
Esempio n. 26
0
bool CHTTPSock::ForceLogin() {
	if (m_bLoggedIn) {
		return true;
	}

	if (SentHeader()) {
		DEBUG("ForceLogin(): Header was already sent!");
		return false;
	}

	AddHeader("WWW-Authenticate", "Basic realm=\"" + CZNC::GetTag(false) + "\"");
	PrintErrorPage(401, "Unauthorized", "You need to login to view this page.");

	return false;
}
    void SubprocessNetworkAccessManager::AddHeader(const QString& name,const QString& value, const QString& callback)
    {
        QString WriteString;
        QXmlStreamWriter xmlWriter(&WriteString);
        xmlWriter.writeStartElement("AddHeader");
            xmlWriter.writeAttribute("name", name);
            xmlWriter.writeAttribute("value", value);
        xmlWriter.writeEndElement();


        Worker->SetScript(callback);
        Worker->SetFailMessage(QString("Timeout during AddHeader"));
        Worker->GetWaiter()->WaitForSignal(this,SIGNAL(AddHeader()), Worker,SLOT(RunSubScript()), Worker, SLOT(FailBecauseOfTimeout()));
        Worker->GetProcessComunicator()->Send(WriteString);
    }
Esempio n. 28
0
void CServerHttpResp::SetRespData( const char* resp_data , const int resp_size )
{
	// 移除content-length头
	RemoveHeader( "content-length" ) ;

	if ( resp_data == NULL || resp_size == 0 )
	{
		return ;
	}

	_sReqData.SetString( resp_data, resp_size ) ;

	char value_buf[100] ;
	sprintf( value_buf , "%d" , resp_size ) ;
	AddHeader( "content-length" , value_buf ) ;
}
Esempio n. 29
0
void
PostScript::AddDefinition (/*[in]*/ PsdefSpecial * ppsdefspecial)
{
  if (ppsdefspecial->GetDef())
  {
    if (find(definitions.begin(), definitions.end(), ppsdefspecial->GetDef())
      == definitions.end())
    {
      definitions.push_back (ppsdefspecial->GetDef());
    }
  }
  else if (ppsdefspecial->GetFileName())
  {
    AddHeader (ppsdefspecial->GetFileName());
  }
}
Esempio n. 30
0
/** Add column label from loop section. */
int CIFfile::DataBlock::AddLoopColumn( const char* ptr, BufferedLine& infile ) {
  if (ptr == 0) return 1;
  // Expect header.id
  int Ncols = infile.TokenizeLine(" \t");
  if ( Ncols > 1 ) {
    mprinterr("Error: Data record expected to have ID only.\n"
              "Error: '%s'\n", ptr);
    return 1;
  }
  std::string ID, Header;
  if (ParseData( std::string(infile.NextToken()), Header, ID )) return 1;
  //mprintf("\n"); // DEBUG
  if (AddHeader( Header )) return 1;
  columnHeaders_.push_back( ID );

  return 0;
}