forked from mirrors/gecko-dev
		
	 4db9ccb1af
			
		
	
	
		4db9ccb1af
		
	
	
	
	
		
			
			MozReview-Commit-ID: JnQzXG581DW Differential Revision: https://phabricator.services.mozilla.com/D6328 --HG-- rename : third_party/rust/crossbeam-utils/.cargo-checksum.json => third_party/rust/crossbeam-utils-0.3.2/.cargo-checksum.json rename : third_party/rust/crossbeam-utils/CHANGELOG.md => third_party/rust/crossbeam-utils-0.3.2/CHANGELOG.md rename : third_party/rust/crossbeam-utils/Cargo.toml => third_party/rust/crossbeam-utils-0.3.2/Cargo.toml rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/crossbeam-utils-0.3.2/LICENSE-MIT rename : third_party/rust/crossbeam-utils/README.md => third_party/rust/crossbeam-utils-0.3.2/README.md rename : third_party/rust/crossbeam-utils/src/cache_padded.rs => third_party/rust/crossbeam-utils-0.3.2/src/cache_padded.rs rename : third_party/rust/crossbeam-utils/src/consume.rs => third_party/rust/crossbeam-utils-0.3.2/src/consume.rs rename : third_party/rust/crossbeam-utils/src/lib.rs => third_party/rust/crossbeam-utils-0.3.2/src/lib.rs rename : third_party/rust/crossbeam-utils/src/scoped.rs => third_party/rust/crossbeam-utils-0.3.2/src/scoped.rs rename : third_party/rust/crossbeam-utils/src/consume.rs => third_party/rust/crossbeam-utils/src/atomic/consume.rs rename : third_party/rust/crossbeam-utils/Cargo.toml => third_party/rust/threadbound/Cargo.toml rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/threadbound/LICENSE-MIT rename : third_party/rust/uuid/.cargo-checksum.json => third_party/rust/uuid-0.6.5/.cargo-checksum.json rename : third_party/rust/uuid/CODE_OF_CONDUCT.md => third_party/rust/uuid-0.6.5/CODE_OF_CONDUCT.md rename : third_party/rust/uuid/Cargo.toml => third_party/rust/uuid-0.6.5/Cargo.toml rename : third_party/rust/crossbeam-utils/LICENSE-MIT => third_party/rust/uuid-0.6.5/LICENSE-MIT rename : third_party/rust/uuid/README.md => third_party/rust/uuid-0.6.5/README.md rename : third_party/rust/uuid/benches/parse_str.rs => third_party/rust/uuid-0.6.5/benches/parse_str.rs rename : third_party/rust/uuid/src/adapter.rs => third_party/rust/uuid-0.6.5/src/adapter.rs rename : third_party/rust/uuid/src/core_support.rs => third_party/rust/uuid-0.6.5/src/core_support.rs rename : third_party/rust/uuid/src/lib.rs => third_party/rust/uuid-0.6.5/src/lib.rs rename : third_party/rust/uuid/src/prelude.rs => third_party/rust/uuid-0.6.5/src/prelude.rs rename : third_party/rust/uuid/src/serde_support.rs => third_party/rust/uuid-0.6.5/src/serde_support.rs rename : third_party/rust/uuid/src/slog_support.rs => third_party/rust/uuid-0.6.5/src/slog_support.rs rename : third_party/rust/uuid/src/std_support.rs => third_party/rust/uuid-0.6.5/src/std_support.rs rename : third_party/rust/uuid/src/test_util.rs => third_party/rust/uuid-0.6.5/src/test_util.rs rename : third_party/rust/uuid/src/u128_support.rs => third_party/rust/uuid-0.6.5/src/u128_support.rs rename : third_party/rust/uuid/benches/parse_str.rs => third_party/rust/uuid/benches/invalid_parse_str.rs rename : third_party/rust/uuid/src/std_support.rs => third_party/rust/uuid/src/parser/std_support.rs extra : moz-landing-system : lando
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 | |
|  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
 | |
|  * This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 | |
| 
 | |
| #include "Variant.h"
 | |
| 
 | |
| extern "C" {
 | |
| 
 | |
| using namespace mozilla::storage;
 | |
| 
 | |
| /**
 | |
|  * Return the data type of the given variant.  This method used to be exposed
 | |
|  * to XPCOM, but since bug 1507540 it's marked [notxpcom] in the interface
 | |
|  * definition, so we need this C function to access it from Rust.
 | |
|  */
 | |
| uint16_t NS_GetDataType(nsIVariant* aVariant) {
 | |
|   return aVariant->GetDataType();
 | |
| }
 | |
| 
 | |
| // Convenience functions to create Storage variants from Rust.
 | |
| void NS_NewStorageNullVariant(nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new NullVariant();
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| void NS_NewStorageBooleanVariant(bool aValue, nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new BooleanVariant(aValue);
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| void NS_NewStorageIntegerVariant(int64_t aValue, nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new IntegerVariant(aValue);
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| void NS_NewStorageFloatVariant(double aValue, nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new FloatVariant(aValue);
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| void NS_NewStorageTextVariant(const nsAString& aValue, nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new TextVariant(aValue);
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| void NS_NewStorageUTF8TextVariant(const nsACString& aValue,
 | |
|                                   nsIVariant** aVariant) {
 | |
|   nsCOMPtr<nsIVariant> variant = new UTF8TextVariant(aValue);
 | |
|   variant.forget(aVariant);
 | |
| }
 | |
| 
 | |
| }  // extern "C"
 |