當前位置: 首頁>>代碼示例>>C++>>正文


C++ Convert函數代碼示例

本文整理匯總了C++中Convert函數的典型用法代碼示例。如果您正苦於以下問題:C++ Convert函數的具體用法?C++ Convert怎麽用?C++ Convert使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Convert函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: malloc

void MediaLibrary::onMediaThumbnailReady( medialibrary::MediaPtr media, bool success )
{
    vlc_ml_event_t ev;
    ev.i_type = VLC_ML_EVENT_MEDIA_THUMBNAIL_GENERATED;
    ev.media_thumbnail_generated.b_success = success;
    auto mPtr = vlc::wrap_cptr<vlc_ml_media_t>(
                static_cast<vlc_ml_media_t*>( malloc( sizeof( vlc_ml_media_t ) ) ),
                vlc_ml_media_release );
    if ( unlikely( mPtr == nullptr ) )
        return;
    ev.media_thumbnail_generated.p_media = mPtr.get();
    if ( Convert( media.get(), *mPtr ) == false )
        return;
    m_vlc_ml->cbs->pf_send_event( m_vlc_ml, &ev );
}
開發者ID:mstorsjo,項目名稱:vlc,代碼行數:15,代碼來源:medialib.cpp

示例2: Convert

nsresult
Convert(const bt_service_record_t& aIn, BluetoothServiceRecord& aOut)
{
  nsresult rv = Convert(aIn.uuid, aOut.mUuid);
  if (NS_FAILED(rv)) {
    return rv;
  }

  aOut.mChannel = aIn.channel;

  MOZ_ASSERT(sizeof(aIn.name) == sizeof(aOut.mName));
  memcpy(aOut.mName, aIn.name, sizeof(aOut.mName));

  return NS_OK;
}
開發者ID:howareyou322,項目名稱:gecko-dev,代碼行數:15,代碼來源:BluetoothHALHelpers.cpp

示例3: Convert

int Convert(const CString& szSrc, CString& szDst, int nConvertWay)
{
	int nSrcLen = szSrc.GetLength();
	if(nSrcLen <= 0)
	{
		szDst.Empty();
		return 0;
	}

	int nResult = 0;
	nResult = Convert(szSrc, nSrcLen, szDst.GetBuffer(nSrcLen), nSrcLen, nConvertWay);
	ASSERT(nResult <= nSrcLen);
	szDst.ReleaseBuffer();
	return nResult;
}
開發者ID:killbug2004,項目名稱:cosps,代碼行數:15,代碼來源:CodePageConverter.cpp

示例4: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    if (a.arguments().size() != 4) {
        std::cout<<std::endl;
        std::cout<<"code_highlight -- part of the Seer app: http://1218.io"<<std::endl;
        std::cout<<"----------------------------------------------------------"<<std::endl;
        std::cout<<"Usage: code_highlight.exe css_filename input_path output_path"<<std::endl;
        std::cout<<std::endl;
        return -1;
    }

    Convert(a.arguments().at(1),a.arguments().at(2),a.arguments().at(3));
    return 0;
}
開發者ID:ccseer,項目名稱:Seer-plugins,代碼行數:16,代碼來源:main.cpp

示例5: ReadStringArray

void ReadStringArray(ifstream& in, vector<string>& data)
{
    data.clear();
    int length;
    in.read((char*)&length, sizeof(int));
    data.resize(length);
    for (vector<string>::iterator it = data.begin(); it != data.end(); ++it)
    {
        int size;
        in.read((char*)&size, sizeof(int));
        char* buffer = new char[size];
        in.read(buffer, sizeof(char) * size);
        Convert(buffer, size, *it);
        delete [] buffer;
    }
}
開發者ID:Samsung,項目名稱:veles.nlp,代碼行數:16,代碼來源:BinaryIO.cpp

示例6: main

int main(int argc, char* argv[])
{
    //check parameters
    if (argc < 2)
    {
        printf("You need to specify input file(s) in application parameters!\n");
        system("pause");
        return 0;
    }

    for (int i = 1; i < argc; i++)
        Convert(argv[i]);

    system("pause");
    return 0;
}
開發者ID:nfprojects,項目名稱:nfengine,代碼行數:16,代碼來源:main.cpp

示例7: assert

inline void fast_Ring< TNum, kdefs>::multInvInPlace( TNum & a) const
{
	#ifdef SAFE
		assert( a==Convert(a) );
	#endif
	TNum const &	res = multiplicativeInverseTable[getSingleIndex( a)];
	if (res.isNotZero() ) 
	{
		a = res;
	}
	else 
	{
		std::cerr << "Multiplicative inverse does not exist!" << std::endl;
		throw "Multiplicative inverse does not exist!" ;
	}
}
開發者ID:jakobkroeker,項目名稱:HMAC,代碼行數:16,代碼來源:fast_Ring.cpp

示例8: UpdateConvertedSurface

	//////////////////////////////////////////////////////////////////////////////
	// UpdateConvertedSurface()
	// Make	sure the bits for a	converted surface are available	and	up to date.
	//////////////////////////////////////////////////////////////////////////////
	void UpdateConvertedSurface(PixelFormat* ppf, const	WinPoint& size,	SurfaceData& data, const SurfaceData& dataSource)
	{
		if( ppf != data.m_ppf )
		{
			ConstructSurfaceData(data, ppf,	size);
		}

		if( data.m_id != dataSource.m_id ) 
		{
			SetSurfaceMode(SurfaceModeDD);

			Convert(size, data.m_pd3dtexture, dataSource.m_pd3dtexture);
//			Convert(size, data.m_pdds, dataSource.m_pdds);
			data.m_id =	dataSource.m_id;
		}
	}
開發者ID:AllegianceZone,項目名稱:Allegiance,代碼行數:20,代碼來源:ddsurface2.cpp

示例9: GetNotRemembered

void userlearn :: GetNotRemembered(std::vector<std::string> &words)
{
    char *filename, *name;
    name = Convert(username);
    filename = Path("record", name, "last.info");
    std::ifstream fin(filename);
    if (!fin) return;
    std::string word;
    int rec;
    while (!fin.eof())
    {
        fin >> word >> rec;
        if (rec == 0)
            words.push_back(word);
    }
}
開發者ID:elecdictionary,項目名稱:dictionary,代碼行數:16,代碼來源:userlearn.cpp

示例10: Convert

nsresult
Convert(const btgatt_gatt_id_t& aIn, BluetoothGattId& aOut)
{
  nsresult rv = Convert(aIn.uuid, aOut.mUuid);
  if (NS_FAILED(rv)) {
    return rv;
  }
  // HAL uses reversed UUID for GATT
  for (uint8_t i = 0; i < sizeof(aOut.mUuid.mUuid) / 2; i++) {
    auto temp = aOut.mUuid.mUuid[i];
    aOut.mUuid.mUuid[i] = aOut.mUuid.mUuid[sizeof(aOut.mUuid.mUuid) - i - 1];
    aOut.mUuid.mUuid[sizeof(aOut.mUuid.mUuid) - i - 1] = temp;
  }
  aOut.mInstanceId = aIn.inst_id;
  return NS_OK;
}
開發者ID:atilag,項目名稱:Gecko,代碼行數:16,代碼來源:BluetoothHALHelpers.cpp

示例11: FindFirstFileA

void ConvertInx::ConvertMonster( const char* Directory )
{
	hDirectory = FindFirstFileA( Format( "%s\\char\\monster\\*", Directory ), &DirAttr );
	s_Inx InxFile = { 0 };
	while( true )
	{
		if( hDirectory != INVALID_HANDLE_VALUE )
		{
			if( DirAttr.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
				break;

			if( DirAttr.dwFileAttributes == FILE_ATTRIBUTE_HIDDEN )
				break;

			hFile = FindFirstFileA( Format( "%s\\char\\monster\\%s\\*.inx", Directory, DirAttr.cFileName ), &FileAttr );
			while( true )
			{
				if( FileAttr.cFileName[ lstrlenA( FileAttr.cFileName ) - 1 ] == 'x' )
				{
					if( FileAttr.nFileSizeLow == OLD_INX_SIZE )
					{
						StringCbCopyA( InxFile.FileName, 256, FileAttr.cFileName );
						StringCbCopyA( InxFile.FullPath, 512, Format( "%s\\char\\monster\\%s\\%s",
							Directory, DirAttr.cFileName, FileAttr.cFileName ) );
						Convert( &InxFile );
					};
				};

				if( FindNextFileA( hFile, &FileAttr ) == FALSE )
					break;
			};

			if( FindNextFileA( hDirectory, &DirAttr ) == FALSE )
			{
				break;
			};
		}
		else
		{
			break;
		};
	};
	hDirectory = NULL;
	hFile = NULL;
	SecureZeroMemory( &DirAttr, sizeof( WIN32_FIND_DATA ) );
	SecureZeroMemory( &FileAttr, sizeof( WIN32_FIND_DATA ) );
};
開發者ID:TreasurePT,項目名稱:TreasurePT,代碼行數:47,代碼來源:convert_inx.cpp

示例12: CheckWord

bool userlearn :: CheckWord(std::string sword)
{
    char *filename, *name;
    std::string wordr;
    name = Convert(username);
    filename = Path("record", name, "remembered.info");
    std::ifstream fin(filename);
    if (!fin)
        return false;
    while (!fin.eof())
    {
        getline(fin, wordr);
        if (wordr.compare(sword) == 0)
            return true;
    }
    return false;
}
開發者ID:elecdictionary,項目名稱:dictionary,代碼行數:17,代碼來源:userlearn.cpp

示例13: main

int main (int argc, char * argv[])
{
  double   dIn;
  double   dOut;
  Measure  factor;
  char     op;
  Unit *   uIn;
  Unit *   uOut;

  if (argc != 3) GiveUsage();
  dIn = atof (argv[1]);
  switch (argv[2][0])
  {
    case 'f': case 'F':
      factor = CONVERT_FEETPERMETER;
      op = '/';
      uIn = &FOOT;
      uOut = &METER;
    break;
    case 'k': case 'K':
      factor = CONVERT_SLUGSPERKILOGRAM;
      op = '*';
      uIn = &KILOGRAM;
      uOut = &SLUG;
    break;
    case 'm': case 'M':
      factor = CONVERT_FEETPERMETER;
      op = '*';
      uIn = &METER;
      uOut = &FOOT;
    break;
    case 's': case 'S':
      factor = CONVERT_SLUGSPERKILOGRAM;
      op = '/';
      uIn = &SLUG;
      uOut = &KILOGRAM;
    break;
    default: GiveUsage(); break;
  }
  dOut = Convert (dIn, uIn, uOut, op, factor);

  cout << dIn << ' ' << uIn->GetName() << " = ";
  cout << dOut << ' ' << uOut->GetName() << endl;

  exit (0);
}
開發者ID:davearonson,項目名稱:meascpp,代碼行數:46,代碼來源:cvtunits.cpp

示例14: main

void main()
   {
   char Reply;
   do
      {
		char Infix[50], Postfix[50]=""; 

      cout << "Enter an infix expression (e.g. (a+b)/c^2, with no spaces):"<< endl;
      cin >> Infix;

      Convert(Infix, Postfix);
      cout << "The equivalent postfix expression is:" << endl<< Postfix << endl;
      cout << endl << "Do another (y/n)? ";
      cin >> Reply;
      }
   while (Reply == 'y');
   }
開發者ID:aarnaout,項目名稱:Infix2postfix_Cpp,代碼行數:17,代碼來源:Arnaout_infix_to_postfix.cpp

示例15: main

int main(int argc, const char **argv)
{
   if (Init(argc,argv) != 0) {
      return 0;
   }

   while (ReadHeader()) {
      Convert();
      ++MemberCount;
   }
   if (MemberCount == 0) {
      MESSAGE(0,("Warning: %s is empty",inpname));
   }

   Cleanup();
   return 0;
}
開發者ID:momtx,項目名稱:meataxe,代碼行數:17,代碼來源:zcv.c


注:本文中的Convert函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。