コード例 #1
0
ファイル: global.cpp プロジェクト: dehilsterlexis/eclide-1
    _variant_t Get(const std::_tstring & section, const std::_tstring & label, const _variant_t & defaultVal)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        SectionLabelDefault sl(SectionLabel(section, label), defaultVal);
        ConfigCacheT::const_iterator found = m_cache.find(sl.first);
        if(sl == GLOBAL_USER && found != m_cache.end())
            if (!CString(m_cache[sl.first]).IsEmpty())
                return m_cache[sl.first];
        if(sl == GLOBAL_PASSWORD && found != m_cache.end())
            if (!CString(m_cache[sl.first]).IsEmpty())
                return m_cache[sl.first];

        if (!m_CfgPath.empty())
        {
            if (found != m_cache.end())
                return found->second;

            CString _defaultVal = defaultVal, _val;
            if (!m_Cfg.GetString(section.c_str(), label.c_str(), _val, _defaultVal))
            {
                //ATLTRACE(_T("GetString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() );
                _val = _defaultVal;
            }
            SectionLabel id(section, label);
            if (CString(m_cache[id]).CompareNoCase(_val) != 0)
            {
                m_cache[id] = _val;
                _variant_t retVal = m_cache[sl.first];
                proc.unlock();
                on_refresh(&id);
                return retVal;
            }
        }
        return m_cache[sl.first];
    }
コード例 #2
0
ファイル: MainFrm2.cpp プロジェクト: dehilsterlexis/eclide
void CMainFrame::ShowDiff(const std::_tstring & lhs, const std::_tstring & lhsHeader, const std::_tstring & rhs, const std::_tstring & rhsHeader)
{
    m_sourceEclView.SetReadOnly(false);
    m_sourceEclView.SetText(lhs.c_str());
    m_sourceEclView.SetReadOnly(true);
    m_targetEclView.SetReadOnly(false);
    m_targetEclView.SetText(rhs.c_str());
    m_targetEclView.SetReadOnly(true);

    m_diffView.SetText(lhs, rhs);
}
コード例 #3
0
ファイル: InsAttrDlg.cpp プロジェクト: GordonSmith/eclide
	bool MessageBox(HWND hwnd, std::_tstring &error_title, std::_tstring &error_msg)
	{
		if (m_errExists)
		{
			if (::MessageBox(hwnd, error_title.c_str(), error_msg.c_str(), MB_ICONASTERISK | MB_YESNO) == IDYES)
				return true;
			m_errExists = false;
		}
		else
			::MessageBox(hwnd, error_title.c_str(), error_msg.c_str(), MB_ICONASTERISK);
		return false;
	}
コード例 #4
0
void CDockableDataViews::SetTabData(const std::_tstring & label, const ITable * data, bool hasRowNum, const roxie::CSearchRowVector & searchResults)
{
    StringResultMap::iterator itr = m_dataTabs.find(label);
    if (itr == m_dataTabs.end())
    {
        m_dataTabs[label] = new CDataView();
        m_dataTabs[label]->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        m_dataTabs[label]->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.InsertTab(m_dataTabs[label], label.c_str(), 0, 0, FALSE);
    }
    m_dataTabs[label]->SetData(data, hasRowNum, searchResults);
    ActivateTab(m_dataTabs[label]);
}
コード例 #5
0
 static void threadLoadAttribute(CWorkspaceItem * self, std::_tstring moduleLabel, std::_tstring attributeLabel, std::_tstring attributeType)
 {
     self->m_loaded = LOADING_STARTED;
     CComPtr<IAttribute> attribute = NULL;
     if (!moduleLabel.empty() && !attributeLabel.empty())
     {
         attribute = self->m_repository->GetAttributeFast(moduleLabel.c_str(), attributeLabel.c_str(), CreateIAttributeType(attributeType), 0, true, true, true);
         if (!attribute)
             attribute = self->m_repository->GetAttributePlaceholder(moduleLabel.c_str(), attributeLabel.c_str(), CreateIAttributeType(attributeType));
     }
     self->SetAttr(attribute);
     self->m_loaded = LOADING_FINISHED;
 }
コード例 #6
0
void CDockablePropertyGridViews::SetTabPropertyGrid(const std::_tstring & label, const ITable* data)
{
    StringPropertyGridMap::const_iterator itr = m_propertyGridTabs.find(label);
    if (itr == m_propertyGridTabs.end())
    {
        bool edges = boost::algorithm::iequals(label, _T("edges"));
        StlLinked<CPropertyGridView> propertyGridView = new CPropertyGridView(edges ? XGMML_CAT_EDGE : XGMML_CAT_VERTEX);
        m_propertyGridTabs[label] = propertyGridView.get();
        propertyGridView->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        propertyGridView->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.AddTab(propertyGridView, label.c_str(), 0, FALSE);
        propertyGridView->SetOwner(m_owner);
    }
    m_propertyGridTabs[label]->SetData(data);
}
コード例 #7
0
 void Update(const std::_tstring &cluster, const std::_tstring &status, const std::vector<ns4__ActiveWorkunit *> &running)
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     m_cluster = cluster.c_str();
     m_queue.clear();
     m_status = status.c_str();
     for(std::size_t i = 0; i < running.size(); ++i)
     {
         if (running[i]->Instance && m_cluster.CompareNoCase(running[i]->Instance->c_str()) == 0)
         {
             //  Creating a workunit can cause a deadlock with the active tree, so set noBroadcast to true.
             CComPtr<Dali::IWorkunit> wu  = Dali::CreateWorkunit(GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_SERVER_WORKUNIT), _T("Dali"), running[i], true);
             ATLASSERT(wu);
             m_queue.push_back(wu.p);
         }
     }
 }
コード例 #8
0
    void Update(const std::_tstring & name, ITable * result)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);

        m_name = name.c_str();

        m_result->LoadFrom(result);
        m_total = result->GetRowCount();
    }
コード例 #9
0
 CWorkspaceItem(IRepository * repository, const std::_tstring & data)
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     m_repository = repository;
     m_props.deserializeXML(data.c_str());
     m_id = m_props.Get(PERSIST_FILEPATH);
     UpdateID();
     m_attributeLoaded = false;
     m_workunitLoaded = false;
     m_loaded = LOADING_UNKNOWN;
 }
コード例 #10
0
ファイル: global.cpp プロジェクト: dehilsterlexis/eclide-1
 void Set(const std::_tstring & section, const std::_tstring & label, const _variant_t & val)
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     SectionLabelDefault sl(SectionLabel(section, label), _T(""));
     if(sl == GLOBAL_USER)
     {
         InitConfigPath(m_CfgName, _T("cfg"));
     }
     SectionLabel id(section, label);
     if (m_cache.find(id) == m_cache.end() || CString(m_cache[id]).CompareNoCase(CString(val)) != 0)
     {
         if (!m_CfgPath.empty() && sl != GLOBAL_PASSWORD)
         {
             CString _val = val;
             if ( !m_Cfg.PutString(section.c_str(), label.c_str(), _val) )
             {
                 ATLTRACE(_T("PutString(%s,%s,Err=%x)\r\n"), section, label, ::GetLastError() );
             }
         }
         m_cache[id] = val;
         proc.unlock();
         on_refresh(&id);
     }
 }
コード例 #11
0
ファイル: InsAttrDlg.cpp プロジェクト: GordonSmith/eclide
	bool OnOk(const std::_tstring & label, std::_tstring &error_title, std::_tstring &error_msg)
	{
		CComPtr<IRepository> rep = ::AttachRepository();
		std::_tstring error;
		if (rep->Label(label.c_str(), error))
		{
			if (!error.length())
			{
				return true;
			}
		}
		error_title = ERR_INVALID_IDENTIFIER_TITLE;
        error_msg = error;
		return false;
	}
コード例 #12
0
void CDockableDataViews::SetTabEcl(const std::_tstring & localFile, int row, const CUniqueID & id)
{
    std::_tstring label = localFile;
    StringSourceMap::iterator itr = m_sourceTabs.find(localFile);
    if (itr == m_sourceTabs.end())
    {
        StlLinked<CLocalDataView> attributeDataView = new CLocalDataView();
        m_sourceTabs[localFile] = attributeDataView.get();
        attributeDataView->Create(NULL, localFile.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        attributeDataView->SetFont(&afxGlobalData.fontRegular);
        boost::filesystem::path p = stringToPath(localFile);
        m_wndTab.AddTab(attributeDataView, pathToWString(p.filename()).c_str(), 0, FALSE);
        attributeDataView->SetOwner(m_owner);
        attributeDataView->SetSource(localFile);
    }
    m_sourceTabs[localFile]->SetBreakpointLocation(row, id);
}
コード例 #13
0
	const TCHAR * ToCSV(std::_tstring & line)
	{
		//  Keep in sync with "CLanguageReference(const std::vector<std::_tstring> & fields)" ---
		std::_tstring encoded;
		line += EncodeForCSV(categoryid.c_str(), encoded);			line += _T(",");
		line += EncodeForCSV(name.c_str(), encoded);				line += _T(",");
		line += EncodeForCSV(tooltip.c_str(), encoded);				line += _T(",");
		line += EncodeForCSV(insertbeforecursor.c_str(), encoded);	line += _T(",");
		line += EncodeForCSV(insertaftercursor.c_str(), encoded);	line += _T(",");
		line += EncodeForCSV(canbefollowedby.c_str(), encoded);	
		return line.c_str();
	}
コード例 #14
0
ファイル: InsAttrDlg.cpp プロジェクト: GordonSmith/eclide
	bool OnOk(const std::_tstring & label, IAttributeType * type, std::_tstring &error_title, std::_tstring &error_msg)
	{
		if (IsValidIdentifier(label))
		{
			CComPtr<IRepository> rep = ::AttachRepository();
			ATLASSERT(m_module.length());
			if (!rep->AttributeExists(m_module.c_str(), label.c_str(), type))
			{
				return true;
			}
			error_title = ERR_INVALID_IDENTIFIER_TITLE;
			error_msg = ERR_IDENTIFIER_EXISTS_AS_ATTRIBUTE;
		}
		else
		{
			error_title = ERR_INVALID_IDENTIFIER_TITLE;
			error_msg = ERR_INVALID_IDENTIFIER;
		}
		return false;
	}
コード例 #15
0
ファイル: TextCompare.cpp プロジェクト: GordonSmith/eclide
void CLine::hash_string(const std::_tstring & s)
{
	// Calc Hash
	boost::crc_32_type computer;
	computer.reset();
	computer.process_bytes(s.c_str(), sizeof(TCHAR) * s.length());
	m_hash = computer.checksum();

	// Calc Anchor Hash
	bool prevIsGraph = true;
	static boost::crc_32_type anchorComputer;
	anchorComputer.reset();
	for (unsigned int i = 0; i < s.length(); ++i)
	{
		bool isGraph = iswgraph(s[i]) != 0 || s[i] == '\r' || s[i] == '\n';
		if (isGraph)
			anchorComputer.process_bytes(&s[i], sizeof(TCHAR));
		prevIsGraph = isGraph;
	}
	m_anchorHash = anchorComputer.checksum();
}
コード例 #16
0
ファイル: Autoupdate.cpp プロジェクト: hpcc-systems/eclide
    void Check(const std::_tstring & _url, const std::_tstring & _product)
    {
        clib::recursive_mutex::scoped_lock proc(m_mutex);
        std::string url = CT2A(_url.c_str());
        std::string product = CT2A(_product.c_str());
        try
        {
            boost::asio::io_service io_service;

            // Get a list of endpoints corresponding to the server name.
            tcp::resolver resolver(io_service);
            tcp::resolver::query query(url, "http");
            tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
            tcp::resolver::iterator end;

            // Try each endpoint until we successfully establish a connection.
            tcp::socket socket(io_service);
            boost::system::error_code error = boost::asio::error::host_not_found;
            while (error && endpoint_iterator != end)
            {
                socket.close();
                socket.connect(*endpoint_iterator++, error);
            }
            if (error)
                throw boost::system::system_error(error);

            // Form the request. We specify the "Connection: close" header so that the
            // server will close the socket after transmitting the response. This will
            // allow us to treat all data up until the EOF as the content.
            boost::asio::streambuf request;
            std::ostream request_stream(&request);
            request_stream << "GET " << product << " HTTP/1.0\r\n";
            request_stream << "Host: " << url << "\r\n";
            request_stream << "Accept: */*\r\n";
            request_stream << "Connection: close\r\n\r\n";

            // Send the request.
            boost::asio::write(socket, request);

            // Read the response status line. The response streambuf will automatically
            // grow to accommodate the entire line. The growth may be limited by passing
            // a maximum size to the streambuf constructor.
            boost::asio::streambuf response;
            boost::asio::read_until(socket, response, "\r\n");

            // Check that response is OK.
            std::istream response_stream(&response);
            std::string http_version;
            response_stream >> http_version;
            unsigned int status_code;
            response_stream >> status_code;
            std::string status_message;
            std::getline(response_stream, status_message);
            if (!response_stream || http_version.substr(0, 5) != "HTTP/")
            {
                m_error = "Invalid response";
                return;
            }
            if (status_code != 200)
            {
                m_error = "Response returned with status code ";
                try {
                    m_error += boost::lexical_cast<std::string>(status_code);
                } catch (const boost::bad_lexical_cast &) {
                    m_error += "\n";
                }
                return;
            }

            // Read the response headers, which are terminated by a blank line.
            boost::asio::read_until(socket, response, "\r\n\r\n");

            // Process the response headers.
            std::string header;
            while (std::getline(response_stream, header) && header != "\r")
                m_header + header + "\n";

            std::stringstream m_responseStream;
            // Write whatever content we already have to output.
            if (response.size() > 0)
                m_responseStream << &response;

            // Read until EOF, writing data to output as we go.
            while (boost::asio::read(socket, response, boost::asio::transfer_at_least(1), error))
                m_responseStream << &response;
            if (error != boost::asio::error::eof)
                throw boost::system::system_error(error);
            m_response = CA2T(m_responseStream.str().c_str());
            boost::algorithm::trim_if(m_response, boost::algorithm::is_any_of(_T("\r\n")));
        }
        catch (const std::exception & ex)
        {
            m_error = ex.what();
        }
        return;
    }
コード例 #17
0
void CRepositoryFilterView::DoSearch(CRepositoryFilterView *self, std::_tstring searchText, std::_tstring searchModule, std::_tstring searchUser, DoSearchOptions searchOptions, std::_tstring dateTime)
{
    CComPtr<IRepository> rep = AttachRepository();
    IAttributeVectorPtr * results = new IAttributeVectorPtr();	//This is released in the submit done.
    int foundCount = rep->FindAttributes(searchText, searchModule, searchUser, searchOptions.mode, searchOptions.sandboxed, searchOptions.checkedout, searchOptions.locked, searchOptions.orphaned, searchOptions.modifiedSince ? dateTime.c_str() : _T(""), *results);
    ::PostMessage(self->m_hWnd, CWM_SUBMITDONE, (WPARAM)(results), foundCount);
}
コード例 #18
0
	const TCHAR * GetFont() const	{return font.c_str();}
コード例 #19
0
 const TCHAR * GetPath()
 {
     return blankString.c_str();
 }
コード例 #20
0
	const TCHAR * GetCanBeFollowedBy() const	{return canbefollowedby.c_str();}
コード例 #21
0
ファイル: BookmarksView.cpp プロジェクト: drealeed/eclide
void CBookmarksView::ParseBookmarksEcl(std::_tstring ecl, std::_tstring user, std::_tstring inModule, std::_tstring inAttributeName, IAttributeType *attrType)
{
    int i = 0;
    int col = 0;
    int row = 0;

    std::_tstring bookmark = _T("");

    SetMarks(inModule, inAttributeName, false);

    for (int b = 0; b < (int)m_listMaster.m_bookmarks.size(); b++)
    {
        bookmark = m_listMaster.m_bookmarks[b];
        if (bookmark.length() == 0) {
            continue;
        }

        int n = static_cast<int>(ecl.find(bookmark, i));

        if (n > 0) {
            std::_tstring line;
            int index = 0;
            bool found = false;

            typedef std::vector<std::_tstring> split_vector_type;
            split_vector_type lines;
            boost::algorithm::split(lines, ecl, boost::algorithm::is_any_of(_T("\n")), boost::algorithm::token_compress_on);

            for (split_vector_type::const_iterator itr = lines.begin(); itr != lines.end(); ++itr)
            {
                line = itr[0];
                ++index;

                n = static_cast<int>(line.find(_T("//"), 0));
                if (n < 0)
                {
                    continue;
                }

                n = static_cast<int>(line.find(bookmark, 0));

                if (n >= 0) {
                    col = 0;

                    std::wostringstream ss;
                    ss << (index);
                    std::_tstring nStr = ss.str();
                    found = false;

                    for (int i = 0; i < m_listMaster.GetItemCount(); ++i)
                    {
                        std::_tstring liner = m_listMaster.GetItemText(i, 0);
                        std::_tstring module = m_listMaster.GetItemText(i, 3);
                        std::_tstring attributeName = m_listMaster.GetItemText(i, 4);

                        if (liner == nStr && module == inModule && attributeName == inAttributeName)
                        {
                            found = true;
                            BookmarkItemData *data = reinterpret_cast<BookmarkItemData *>(m_listMaster.GetItemData(i));
                            data->marked = true;
                            break;
                        }
                    }

                    if (!found) {
                        row = m_listMaster.InsertItem(col++, nStr.c_str());
                        m_listMaster.SetItemText(row, col++, bookmark.c_str());
                        m_listMaster.SetItemText(row, col++, user.c_str());
                        m_listMaster.SetItemText(row, col++, inModule.c_str());
                        m_listMaster.SetItemText(row, col++, inAttributeName.c_str());
                        m_listMaster.SetItemText(row, col++, attrType->GetRepositoryCode());
                        m_listMaster.SetItemText(row, col++, trim(line.substr(n + m_listMaster.m_bookmarks[b].length())).c_str());
                        BookmarkItemData *data = new BookmarkItemData;
                        data->marked = true;
                        data->bookmarkType = (BM_TYPE)b;
                        data->column = n;
                        m_listMaster.SetItemData(row, (DWORD_PTR)data);
                    }
                }
            }
        }
    }

    DeleteMarkedBookmarks(inModule, inAttributeName,false);

    for (int i = 0; i < col; ++i)
    {
        m_listMaster.SetColumnWidth(i, LVSCW_AUTOSIZE_USEHEADER);
    }

    DoRefresh(NULL, 0);
}
コード例 #22
0
	const TCHAR * GetAfterBeforeCursor() const	{return insertaftercursor.c_str();}
コード例 #23
0
ファイル: InsAttrDlg.cpp プロジェクト: GordonSmith/eclide
	bool MessageBox(HWND hwnd, std::_tstring &error_title, std::_tstring &error_msg)
	{
		::MessageBox(hwnd, error_title.c_str(), error_msg.c_str(), MB_ICONASTERISK);
		return false;
	}
コード例 #24
0
void CWizardSprayAnalyze::LogMessage(const std::_tstring &msg)
{
	m_analyzeStatus.AppendText(msg.c_str());
}
コード例 #25
0
ファイル: Module.cpp プロジェクト: dehilsterlexis/eclide-1
 const TCHAR *GetPath() const
 {
     clib::recursive_mutex::scoped_lock proc(m_mutex);
     return modEmptyString.c_str();
 }
コード例 #26
0
	const TCHAR * GetName() const { return name.c_str(); }
コード例 #27
0
ファイル: UnicodeFile.cpp プロジェクト: GordonSmith/eclide
void CUnicodeFile::Write(const std::_tstring & data)
{
	Write(data.c_str());
}
コード例 #28
0
	const TCHAR * GetTooltip() const			{return tooltip.c_str();}
コード例 #29
0
	const TCHAR * GetSample() const { return sample.c_str(); }
コード例 #30
0
	const TCHAR * GetInsertBeforeCursor() const	{return insertbeforecursor.c_str();}