Esempio n. 1
0
BEGIN_NCBI_SCOPE

CResultSet::CResultSet(CConnection* conn, CDB_Result *rs) : 
    m_conn(conn),
    m_rs(rs), 
    m_metaData(NULL),
    m_istr(0), 
    m_ostr(0), 
    m_column(-1),
    m_bindBlob(true), 
    m_disableBind(false), 
    m_wasNull(true),
    m_rd(0), 
    m_totalRows(0),
    m_LastVariantNum(0),
    m_RowReadType(eReadUnknown)
{
    SetIdent("CResultSet");

    if( m_rs == 0 ) {
        _TRACE("CResultSet::ctor(): null CDB_Result* object");
        _ASSERT(0);
    }
    else {
        Init();
    }
}
void
nsHttpChannelAuthProvider::GetIdentityFromURI(uint32_t            authFlags,
                                              nsHttpAuthIdentity &ident)
{
    LOG(("nsHttpChannelAuthProvider::GetIdentityFromURI [this=%p channel=%p]\n",
        this, mAuthChannel));

    nsAutoString userBuf;
    nsAutoString passBuf;

    // XXX i18n
    nsCAutoString buf;
    mURI->GetUsername(buf);
    if (!buf.IsEmpty()) {
        NS_UnescapeURL(buf);
        CopyASCIItoUTF16(buf, userBuf);
        mURI->GetPassword(buf);
        if (!buf.IsEmpty()) {
            NS_UnescapeURL(buf);
            CopyASCIItoUTF16(buf, passBuf);
        }
    }

    if (!userBuf.IsEmpty()) {
        SetIdent(ident, authFlags, (PRUnichar *) userBuf.get(),
                 (PRUnichar *) passBuf.get());
    }
}
Esempio n. 3
0
CConnection::CConnection(CDB_Connection *conn, CDataSource* ds)
    : m_ds(ds), m_connection(conn), m_connCounter(-1), m_connUsed(false),
      m_modeMask(0), m_forceSingle(false), m_multiExH(0),
      m_msgToEx(false), m_ownership(eNoOwnership)
{
    _TRACE("Auxiliary connection " << (void *)this << " created...");
    SetIdent("CConnection");
}
	TScale(TReal sx,TReal sy,TReal sz)
	{
		SetIdent();

		m_data[0][0] = sx;
		m_data[1][1] = sy;
		m_data[2][2] = sz;
	}
	TScale(CVector3D<TReal> vs)
	{
		SetIdent();

		m_data[0][0] = vs.m_data[0][0];
		m_data[1][1] = vs.m_data[0][1];
		m_data[2][2] = vs.m_data[0][2];
	}
	TTranslation(TReal tx,TReal ty,TReal tz)
	{
		SetIdent();

		m_data[3][0] = tx;
		m_data[3][1] = ty;
		m_data[3][2] = tz;
	}
	TTranslation(CVector3D<TReal> vt)
	{
		SetIdent();

		m_data[3][0] = vt.m_data[0][0];
		m_data[3][1] = vt.m_data[0][1];
		m_data[3][2] = vt.m_data[0][2];
	}
Esempio n. 8
0
File: Nick.cpp Progetto: jimloco/znc
void CNick::Clone(const CNick& SourceNick) {
	SetNick(SourceNick.GetNick());
	SetIdent(SourceNick.GetIdent());
	SetHost(SourceNick.GetHost());

	m_sChanPerms = SourceNick.m_sChanPerms;
	m_pNetwork = SourceNick.m_pNetwork;
}
	TRotationY(TReal angle)
	{
		SetIdent();

		m_data[0][0] = IEMath<TReal>::Cos(angle);
		m_data[0][2] = -(IEMath<TReal>::Sin(angle));
		m_data[2][0] = IEMath<TReal>::Sin(angle);
		m_data[2][2] = IEMath<TReal>::Cos(angle);
	}
Esempio n. 10
0
BEGIN_NCBI_SCOPE

// implementation
CDBAPIBulkInsert::CDBAPIBulkInsert(const string& name,
                                   CConnection* conn)
    : m_cmd(0), m_conn(conn)
{
    m_cmd = m_conn->GetCDB_Connection()->BCPIn(name);
    SetIdent("CDBAPIBulkInsert");
}
Esempio n. 11
0
BEGIN_NCBI_SCOPE

// Implementation
CConnection::CConnection(CDataSource* ds, EOwnership ownership)
    : m_ds(ds), m_connection(0), m_connCounter(1), m_connUsed(false),
      m_modeMask(0), m_forceSingle(false), m_multiExH(0),
      m_msgToEx(false), m_ownership(ownership)
{
    _TRACE("Default connection " << (void *)this << " created...");
    SetIdent("CConnection");
}
Esempio n. 12
0
BEGIN_NCBI_SCOPE

// implementation
CCallableStatement::CCallableStatement(const string& proc,
                       CConnection* conn)
: CStatement(conn)
, m_status(0)
, m_StatusIsAvailable(false)
{
    SetBaseCmd(conn->GetCDB_Connection()->RPC(proc));
    SetIdent("CCallableStatement");
}
Esempio n. 13
0
BEGIN_NCBI_SCOPE

// implementation
CCursor::CCursor(const string& name,
                 const string& sql,
                 int batchSize,
                 CConnection* conn)
    : m_cmd(0), m_conn(conn), m_ostr(0), m_wr(0)
{
    SetIdent("CCursor");

    m_cmd = m_conn->GetCDB_Connection()->Cursor(name, sql, batchSize);
}
Esempio n. 14
0
////////////////////////////////////////////////////////////////////////////////
// implementation
CStatement::CStatement(CConnection* conn)
: m_conn(conn)
, m_cmd(NULL)
, m_InParams(m_cmd)
, m_rowCount(-1)
, m_failed(false)
, m_irs(0)
, m_wr(0)
, m_ostr(0)
, m_AutoClearInParams(false)
{
    SetIdent("CStatement");
}
Esempio n. 15
0
void KVTGIDZA::AddLineToGrid(KVIDGrid * g, Int_t Z, Int_t npoints,
                             Double_t xmin, Double_t xmax, Bool_t log_scale)
{
   //Add a line to the grid 'g' for identification label 'Z' with 'npoints' points calculated between
   //X-coordinates xmin and xmax. Points are omitted if the resulting value of the functional is
   //not a number (TMath::IsNan = kTRUE).
   //
   //For Z<=8 several KVIDZALines are added for common isotopes (p,d,t, 3He, etc.)
   //For Z>8 a line for the current Z is drawn, with the A corresponding to Charity's EAL formula
   //
   //Before using this method the user must have set the name of
   //the parameter in the identification functional which corresponds to the
   //atomic number Z i.e. using
   //      SetParName(i,"Z")
   //with i=the relevant parameter index.
   //
   // If log_scale=kTRUE (default is kFALSE), more points are used at the beginning
   // of the line than at the end, with a logarithmic dependence.

   //A & Z identification
   //on va faire: p,d,t,3He,4He,6He,6Li,7Li,8Li,7Be,9Be, etc.
   static Int_t Ziso[] =
       { 1, 1, 1,
		 	2, 2, 2,
			3, 3, 3,
			4, 4, 4,
			5, 5, 5,
			6, 6, 6,
			7, 7, 7,
			8, 8, 8
   };
   static Int_t Aiso[] =
       { 1, 2, 3,
			3, 4, 6,
			6, 7, 8,
			7, 9, 10,
			10, 11, 12,
			12, 13, 14,
			14, 15, 16,
			15, 16, 17
   };
   static Int_t nisotopes = 24; //number of isotopes in arrays
   static Int_t Zindex_start[] = { -1, 0, 3, 6, 9, 12, 15, 18, 21 };    //index of first isotope for each Z
   static Int_t Zindex_stop[] = { -1, 2, 5, 8, 11, 14, 17, 20, 23 };    //index of last isotope for each Z

   if (Z <= Ziso[nisotopes - 1]) {
      //Z is included in table of isotopes
      //we add several lines corresponding to the tabulated isotopes
      for (int iso = Zindex_start[Z]; iso <= Zindex_stop[Z]; iso++) {   //loop over isotopes for this Z
         //add new line to grid
         KVIDLine *new_line = AddLine(g);

         //set identification label for line
         Double_t idlab = 100. * Ziso[iso] + Aiso[iso];
         SetIdent(new_line, idlab);

         //set Z of line in functional
         SetParameter("Z", (Double_t) Ziso[iso]);
         //loop over points of line
         Int_t p_index = 0;
   Double_t X, dX;
   Double_t Y = 0.;
   Double_t logXmin = TMath::Log( TMath::Max(xmin,1.0) );
   if(log_scale)
      dX = (TMath::Log(xmax) - logXmin)/( npoints - 1. );
   else
      dX = (xmax - xmin) / (Double_t) (npoints - 1);

         for (Int_t i = 0; i < npoints; i++) {

            //x coordinate of this point
      if(log_scale)
         X = TMath::Exp(logXmin + i*dX);
      else
         X = xmin + dX * ((Double_t) i);

            //leave value Y as it is. The value of GetIDFunc()->Eval(ID)
            //is the vertical distance delta_Y from point (X,Y) to the line; therefore the
            //Y coordinate of the point on the line is Y + delta_Y, whatever the value Y.

            //set values of parameters which correspond to X and Y coordinates in grid
            SetParameter("X", X);
            SetParameter("Y", Y);

            Y += Eval((Double_t) Aiso[iso]);

            if (!TMath::IsNaN(Y))
               new_line->SetPoint(p_index++, X, Y);
            else
               Y = 0.;          //reset Y to 0 if it ever becomes NaN
         }
      }
   } else {
      //Z is bigger than largest Z for which we have isotopes
      //we add one line for this Z using mass formula

      //get mass for nucleus
      Int_t A = KVNucleus::GetAFromZ(Z, fMassFormula);
      //add new line to grid
      KVIDLine *new_line = AddLine(g);
      //set identification label for line
      Double_t idlab = 100. * Z + A;
      SetIdent(new_line, idlab);

      //set Z of line in functional
      SetParameter("Z", (Double_t) Z);
      //loop over points of line
      Int_t p_index = 0;
      Double_t Y = 0., X, dX = (xmax - xmin) / (Double_t) (npoints - 1);

      for (Int_t i = 0; i < npoints; i++) {

         //x coordinate of this point
         X = xmin + dX * ((Double_t) i);

         //leave value Y as it is. The value of GetIDFunc()->Eval(ID)
         //is the vertical distance delta_Y from point (X,Y) to the line; therefore the
         //Y coordinate of the point on the line is Y + delta_Y, whatever the value Y.

         //set values of parameters which correspond to X and Y coordinates in grid
         SetParameter("X", X);
         SetParameter("Y", Y);

         Y += Eval((Double_t) A);

         if (!TMath::IsNaN(Y))
            new_line->SetPoint(p_index++, X, Y);
         else
            Y = 0.;             //reset Y to 0 if it ever becomes NaN
      }
   }
}
Esempio n. 16
0
void CIRCNetwork::Clone(const CIRCNetwork& Network) {
	m_sName = Network.GetName();

	SetNick(Network.GetNick());
	SetAltNick(Network.GetAltNick());
	SetIdent(Network.GetIdent());
	SetRealName(Network.GetRealName());

	// Servers
	const vector<CServer*>& vServers = Network.GetServers();
	CString sServer;
	CServer* pCurServ = GetCurrentServer();

	if (pCurServ) {
		sServer = pCurServ->GetName();
	}

	DelServers();

	unsigned int a;
	for (a = 0; a < vServers.size(); a++) {
		CServer* pServer = vServers[a];
		AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
	}

	m_uServerIdx = 0;
	for (a = 0; a < m_vServers.size(); a++) {
		if (sServer.Equals(m_vServers[a]->GetName())) {
			m_uServerIdx = a + 1;
			break;
		}
	}
	if (m_uServerIdx == 0) {
		m_uServerIdx = m_vServers.size();
		CIRCSock* pSock = GetIRCSock();

		if (pSock) {
			PutStatus("Jumping servers because this server is no longer in the list");
			pSock->Quit();
		}
	}
	// !Servers

	// Chans
	const vector<CChan*>& vChans = Network.GetChans();
	for (a = 0; a < vChans.size(); a++) {
		CChan* pNewChan = vChans[a];
		CChan* pChan = FindChan(pNewChan->GetName());

		if (pChan) {
			pChan->SetInConfig(pNewChan->InConfig());
		} else {
			AddChan(pNewChan->GetName(), pNewChan->InConfig());
		}
	}

	for (a = 0; a < m_vChans.size(); a++) {
		CChan* pChan = m_vChans[a];
		CChan* pNewChan = Network.FindChan(pChan->GetName());

		if (!pNewChan) {
			pChan->SetInConfig(false);
		} else {
			pChan->Clone(*pNewChan);
		}
	}
	// !Chans

	// Modules
	set<CString> ssUnloadMods;
	CModules& vCurMods = GetModules();
	const CModules& vNewMods = Network.GetModules();

	for (a = 0; a < vNewMods.size(); a++) {
		CString sModRet;
		CModule* pNewMod = vNewMods[a];
		CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());

		if (!pCurMod) {
			vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::NetworkModule, m_pUser, this, sModRet);
		} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
			vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), m_pUser, this, sModRet);
		}
	}

	for (a = 0; a < vCurMods.size(); a++) {
		CModule* pCurMod = vCurMods[a];
		CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());

		if (!pNewMod) {
			ssUnloadMods.insert(pCurMod->GetModName());
		}
	}

	for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); ++it) {
		vCurMods.UnloadModule(*it);
	}
	// !Modules

	SetIRCConnectEnabled(Network.GetIRCConnectEnabled());
}
Esempio n. 17
0
File: User.cpp Progetto: b3rend/znc
bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
	unsigned int a = 0;
	sErrorRet.clear();

	if (!User.IsValid(sErrorRet, true)) {
		return false;
	}

	// user names can only specified for the constructor, changing it later
	// on breaks too much stuff (e.g. lots of paths depend on the user name)
	if (GetUserName() != User.GetUserName()) {
		DEBUG("Ignoring username in CUser::Clone(), old username [" << GetUserName()
				<< "]; New username [" << User.GetUserName() << "]");
	}

	if (!User.GetPass().empty()) {
		SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
	}

	SetNick(User.GetNick(false));
	SetAltNick(User.GetAltNick(false));
	SetIdent(User.GetIdent(false));
	SetRealName(User.GetRealName());
	SetStatusPrefix(User.GetStatusPrefix());
	SetBindHost(User.GetBindHost());
	SetDCCBindHost(User.GetDCCBindHost());
	SetQuitMsg(User.GetQuitMsg());
	SetSkinName(User.GetSkinName());
	SetLanguage(User.GetLanguage());
	SetDefaultChanModes(User.GetDefaultChanModes());
	SetBufferCount(User.GetBufferCount(), true);
	SetJoinTries(User.JoinTries());
	SetMaxJoins(User.MaxJoins());

	// Allowed Hosts
	m_ssAllowedHosts.clear();
	const set<CString>& ssHosts = User.GetAllowedHosts();
	for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
		AddAllowedHost(*it);
	}

	for (a = 0; a < m_vClients.size(); a++) {
		CClient* pSock = m_vClients[a];

		if (!IsHostAllowed(pSock->GetRemoteIP())) {
			pSock->PutStatusNotice("You are being disconnected because your IP is no longer allowed to connect to this user");
			pSock->Close();
		}
	}

	// !Allowed Hosts

	// Networks
	const vector<CIRCNetwork*>& vNetworks = User.GetNetworks();
	for (a = 0; a < vNetworks.size(); a++) {
		new CIRCNetwork(this, vNetworks[a], bCloneChans);
	}
	// !Networks

	// CTCP Replies
	m_mssCTCPReplies.clear();
	const MCString& msReplies = User.GetCTCPReplies();
	for (MCString::const_iterator it = msReplies.begin(); it != msReplies.end(); ++it) {
		AddCTCPReply(it->first, it->second);
	}
	// !CTCP Replies

	// Flags
	SetIRCConnectEnabled(User.GetIRCConnectEnabled());
	SetKeepBuffer(User.KeepBuffer());
	SetMultiClients(User.MultiClients());
	SetDenyLoadMod(User.DenyLoadMod());
	SetAdmin(User.IsAdmin());
	SetDenySetBindHost(User.DenySetBindHost());
	SetTimestampAppend(User.GetTimestampAppend());
	SetTimestampPrepend(User.GetTimestampPrepend());
	SetTimestampFormat(User.GetTimestampFormat());
	SetTimezoneOffset(User.GetTimezoneOffset());
	// !Flags

	// Modules
	set<CString> ssUnloadMods;
	CModules& vCurMods = GetModules();
	const CModules& vNewMods = User.GetModules();

	for (a = 0; a < vNewMods.size(); a++) {
		CString sModRet;
		CModule* pNewMod = vNewMods[a];
		CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());

		if (!pCurMod) {
			vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::UserModule, this, NULL, sModRet);
		} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
			vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, NULL, sModRet);
		}
	}

	for (a = 0; a < vCurMods.size(); a++) {
		CModule* pCurMod = vCurMods[a];
		CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());

		if (!pNewMod) {
			ssUnloadMods.insert(pCurMod->GetModName());
		}
	}

	for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); ++it) {
		vCurMods.UnloadModule(*it);
	}
	// !Modules

	return true;
}
Esempio n. 18
0
bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
	unsigned int a = 0;
	sErrorRet.clear();

	if (!User.IsValid(sErrorRet, true)) {
		return false;
	}

	// user names can only specified for the constructor, changing it later
	// on breaks too much stuff (e.g. lots of paths depend on the user name)
	if (GetUserName() != User.GetUserName()) {
		DEBUG("Ignoring username in CUser::Clone(), old username [" << GetUserName()
				<< "]; New username [" << User.GetUserName() << "]");
	}

	if (!User.GetPass().empty()) {
		SetPass(User.GetPass(), User.GetPassHashType(), User.GetPassSalt());
	}

	SetNick(User.GetNick(false));
	SetAltNick(User.GetAltNick(false));
	SetIdent(User.GetIdent(false));
	SetRealName(User.GetRealName());
	SetStatusPrefix(User.GetStatusPrefix());
	SetBindHost(User.GetBindHost());
	SetDCCBindHost(User.GetDCCBindHost());
	SetQuitMsg(User.GetQuitMsg());
	SetSkinName(User.GetSkinName());
	SetDefaultChanModes(User.GetDefaultChanModes());
	SetBufferCount(User.GetBufferCount(), true);
	SetJoinTries(User.JoinTries());
	SetMaxJoins(User.MaxJoins());

	// Allowed Hosts
	m_ssAllowedHosts.clear();
	const set<CString>& ssHosts = User.GetAllowedHosts();
	for (set<CString>::const_iterator it = ssHosts.begin(); it != ssHosts.end(); ++it) {
		AddAllowedHost(*it);
	}

	for (a = 0; a < m_vClients.size(); a++) {
		CClient* pSock = m_vClients[a];

		if (!IsHostAllowed(pSock->GetRemoteIP())) {
			pSock->PutStatusNotice("You are being disconnected because your IP is no longer allowed to connect to this user");
			pSock->Close();
		}
	}

	// !Allowed Hosts

	// Servers
	const vector<CServer*>& vServers = User.GetServers();
	CString sServer;
	CServer* pCurServ = GetCurrentServer();

	if (pCurServ) {
		sServer = pCurServ->GetName();
	}

	DelServers();

	for (a = 0; a < vServers.size(); a++) {
		CServer* pServer = vServers[a];
		AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL());
	}

	m_uServerIdx = 0;
	for (a = 0; a < m_vServers.size(); a++) {
		if (sServer.Equals(m_vServers[a]->GetName())) {
			m_uServerIdx = a + 1;
			break;
		}
	}
	if (m_uServerIdx == 0) {
		m_uServerIdx = m_vServers.size();
		CIRCSock* pSock = GetIRCSock();

		if (pSock) {
			PutStatus("Jumping servers because this server is no longer in the list");
			pSock->Quit();
		}
	}
	// !Servers

	// Chans
	const vector<CChan*>& vChans = User.GetChans();
	for (a = 0; a < vChans.size(); a++) {
		CChan* pNewChan = vChans[a];
		CChan* pChan = FindChan(pNewChan->GetName());

		if (pChan) {
			pChan->SetInConfig(pNewChan->InConfig());
		} else {
			AddChan(pNewChan->GetName(), pNewChan->InConfig());
		}
	}

	for (a = 0; a < m_vChans.size(); a++) {
		CChan* pChan = m_vChans[a];
		CChan* pNewChan = User.FindChan(pChan->GetName());

		if (!pNewChan) {
			pChan->SetInConfig(false);
		} else {
			if (bCloneChans)
				pChan->Clone(*pNewChan);
		}
	}
	// !Chans

	// CTCP Replies
	m_mssCTCPReplies.clear();
	const MCString& msReplies = User.GetCTCPReplies();
	for (MCString::const_iterator it = msReplies.begin(); it != msReplies.end(); ++it) {
		AddCTCPReply(it->first, it->second);
	}
	// !CTCP Replies

	// Flags
	SetIRCConnectEnabled(User.GetIRCConnectEnabled());
	SetKeepBuffer(User.KeepBuffer());
	SetMultiClients(User.MultiClients());
	SetBounceDCCs(User.BounceDCCs());
	SetUseClientIP(User.UseClientIP());
	SetDenyLoadMod(User.DenyLoadMod());
	SetAdmin(User.IsAdmin());
	SetDenySetBindHost(User.DenySetBindHost());
	SetTimestampAppend(User.GetTimestampAppend());
	SetTimestampPrepend(User.GetTimestampPrepend());
	SetTimestampFormat(User.GetTimestampFormat());
	SetTimezoneOffset(User.GetTimezoneOffset());
	// !Flags

	// Modules
	set<CString> ssUnloadMods;
	CModules& vCurMods = GetModules();
	const CModules& vNewMods = User.GetModules();

	for (a = 0; a < vNewMods.size(); a++) {
		CString sModRet;
		CModule* pNewMod = vNewMods[a];
		CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());

		if (!pCurMod) {
			vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, sModRet);
		} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
			vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, sModRet);
		}
	}

	for (a = 0; a < vCurMods.size(); a++) {
		CModule* pCurMod = vCurMods[a];
		CModule* pNewMod = vNewMods.FindModule(pCurMod->GetModName());

		if (!pNewMod) {
			ssUnloadMods.insert(pCurMod->GetModName());
		}
	}

	for (set<CString>::iterator it = ssUnloadMods.begin(); it != ssUnloadMods.end(); ++it) {
		vCurMods.UnloadModule(*it);
	}
	// !Modules

	return true;
}