StreamingDistributionSummary& StreamingDistributionSummary::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode idNode = resultNode.FirstChild("Id");
    if(!idNode.IsNull())
    {
      m_id = StringUtils::Trim(idNode.GetText().c_str());
      m_idHasBeenSet = true;
    }
    XmlNode statusNode = resultNode.FirstChild("Status");
    if(!statusNode.IsNull())
    {
      m_status = StringUtils::Trim(statusNode.GetText().c_str());
      m_statusHasBeenSet = true;
    }
    XmlNode lastModifiedTimeNode = resultNode.FirstChild("LastModifiedTime");
    if(!lastModifiedTimeNode.IsNull())
    {
      m_lastModifiedTime = DateTime(StringUtils::Trim(lastModifiedTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_lastModifiedTimeHasBeenSet = true;
    }
    XmlNode domainNameNode = resultNode.FirstChild("DomainName");
    if(!domainNameNode.IsNull())
    {
      m_domainName = StringUtils::Trim(domainNameNode.GetText().c_str());
      m_domainNameHasBeenSet = true;
    }
    XmlNode s3OriginNode = resultNode.FirstChild("S3Origin");
    if(!s3OriginNode.IsNull())
    {
      m_s3Origin = s3OriginNode;
      m_s3OriginHasBeenSet = true;
    }
    XmlNode aliasesNode = resultNode.FirstChild("Aliases");
    if(!aliasesNode.IsNull())
    {
      m_aliases = aliasesNode;
      m_aliasesHasBeenSet = true;
    }
    XmlNode trustedSignersNode = resultNode.FirstChild("TrustedSigners");
    if(!trustedSignersNode.IsNull())
    {
      m_trustedSigners = trustedSignersNode;
      m_trustedSignersHasBeenSet = true;
    }
    XmlNode commentNode = resultNode.FirstChild("Comment");
    if(!commentNode.IsNull())
    {
      m_comment = StringUtils::Trim(commentNode.GetText().c_str());
      m_commentHasBeenSet = true;
    }
    XmlNode priceClassNode = resultNode.FirstChild("PriceClass");
    if(!priceClassNode.IsNull())
    {
      m_priceClass = PriceClassMapper::GetPriceClassForName(StringUtils::Trim(priceClassNode.GetText().c_str()).c_str());
      m_priceClassHasBeenSet = true;
    }
    XmlNode enabledNode = resultNode.FirstChild("Enabled");
    if(!enabledNode.IsNull())
    {
      m_enabled = StringUtils::ConvertToBool(StringUtils::Trim(enabledNode.GetText().c_str()).c_str());
      m_enabledHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 2
0
CacheCluster& CacheCluster::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode cacheClusterIdNode = resultNode.FirstChild("CacheClusterId");
    if(!cacheClusterIdNode.IsNull())
    {
      m_cacheClusterId = StringUtils::Trim(cacheClusterIdNode.GetText().c_str());
      m_cacheClusterIdHasBeenSet = true;
    }
    XmlNode configurationEndpointNode = resultNode.FirstChild("ConfigurationEndpoint");
    if(!configurationEndpointNode.IsNull())
    {
      m_configurationEndpoint = configurationEndpointNode;
      m_configurationEndpointHasBeenSet = true;
    }
    XmlNode clientDownloadLandingPageNode = resultNode.FirstChild("ClientDownloadLandingPage");
    if(!clientDownloadLandingPageNode.IsNull())
    {
      m_clientDownloadLandingPage = StringUtils::Trim(clientDownloadLandingPageNode.GetText().c_str());
      m_clientDownloadLandingPageHasBeenSet = true;
    }
    XmlNode cacheNodeTypeNode = resultNode.FirstChild("CacheNodeType");
    if(!cacheNodeTypeNode.IsNull())
    {
      m_cacheNodeType = StringUtils::Trim(cacheNodeTypeNode.GetText().c_str());
      m_cacheNodeTypeHasBeenSet = true;
    }
    XmlNode engineNode = resultNode.FirstChild("Engine");
    if(!engineNode.IsNull())
    {
      m_engine = StringUtils::Trim(engineNode.GetText().c_str());
      m_engineHasBeenSet = true;
    }
    XmlNode engineVersionNode = resultNode.FirstChild("EngineVersion");
    if(!engineVersionNode.IsNull())
    {
      m_engineVersion = StringUtils::Trim(engineVersionNode.GetText().c_str());
      m_engineVersionHasBeenSet = true;
    }
    XmlNode cacheClusterStatusNode = resultNode.FirstChild("CacheClusterStatus");
    if(!cacheClusterStatusNode.IsNull())
    {
      m_cacheClusterStatus = StringUtils::Trim(cacheClusterStatusNode.GetText().c_str());
      m_cacheClusterStatusHasBeenSet = true;
    }
    XmlNode numCacheNodesNode = resultNode.FirstChild("NumCacheNodes");
    if(!numCacheNodesNode.IsNull())
    {
      m_numCacheNodes = StringUtils::ConvertToInt32(StringUtils::Trim(numCacheNodesNode.GetText().c_str()).c_str());
      m_numCacheNodesHasBeenSet = true;
    }
    XmlNode preferredAvailabilityZoneNode = resultNode.FirstChild("PreferredAvailabilityZone");
    if(!preferredAvailabilityZoneNode.IsNull())
    {
      m_preferredAvailabilityZone = StringUtils::Trim(preferredAvailabilityZoneNode.GetText().c_str());
      m_preferredAvailabilityZoneHasBeenSet = true;
    }
    XmlNode cacheClusterCreateTimeNode = resultNode.FirstChild("CacheClusterCreateTime");
    if(!cacheClusterCreateTimeNode.IsNull())
    {
      m_cacheClusterCreateTime = DateTime(StringUtils::Trim(cacheClusterCreateTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_cacheClusterCreateTimeHasBeenSet = true;
    }
    XmlNode preferredMaintenanceWindowNode = resultNode.FirstChild("PreferredMaintenanceWindow");
    if(!preferredMaintenanceWindowNode.IsNull())
    {
      m_preferredMaintenanceWindow = StringUtils::Trim(preferredMaintenanceWindowNode.GetText().c_str());
      m_preferredMaintenanceWindowHasBeenSet = true;
    }
    XmlNode pendingModifiedValuesNode = resultNode.FirstChild("PendingModifiedValues");
    if(!pendingModifiedValuesNode.IsNull())
    {
      m_pendingModifiedValues = pendingModifiedValuesNode;
      m_pendingModifiedValuesHasBeenSet = true;
    }
    XmlNode notificationConfigurationNode = resultNode.FirstChild("NotificationConfiguration");
    if(!notificationConfigurationNode.IsNull())
    {
      m_notificationConfiguration = notificationConfigurationNode;
      m_notificationConfigurationHasBeenSet = true;
    }
    XmlNode cacheSecurityGroupsNode = resultNode.FirstChild("CacheSecurityGroups");
    if(!cacheSecurityGroupsNode.IsNull())
    {
      XmlNode cacheSecurityGroupsMember = cacheSecurityGroupsNode.FirstChild("CacheSecurityGroup");
      while(!cacheSecurityGroupsMember.IsNull())
      {
        m_cacheSecurityGroups.push_back(cacheSecurityGroupsMember);
        cacheSecurityGroupsMember = cacheSecurityGroupsMember.NextNode("CacheSecurityGroup");
      }

      m_cacheSecurityGroupsHasBeenSet = true;
    }
    XmlNode cacheParameterGroupNode = resultNode.FirstChild("CacheParameterGroup");
    if(!cacheParameterGroupNode.IsNull())
    {
      m_cacheParameterGroup = cacheParameterGroupNode;
      m_cacheParameterGroupHasBeenSet = true;
    }
    XmlNode cacheSubnetGroupNameNode = resultNode.FirstChild("CacheSubnetGroupName");
    if(!cacheSubnetGroupNameNode.IsNull())
    {
      m_cacheSubnetGroupName = StringUtils::Trim(cacheSubnetGroupNameNode.GetText().c_str());
      m_cacheSubnetGroupNameHasBeenSet = true;
    }
    XmlNode cacheNodesNode = resultNode.FirstChild("CacheNodes");
    if(!cacheNodesNode.IsNull())
    {
      XmlNode cacheNodesMember = cacheNodesNode.FirstChild("CacheNode");
      while(!cacheNodesMember.IsNull())
      {
        m_cacheNodes.push_back(cacheNodesMember);
        cacheNodesMember = cacheNodesMember.NextNode("CacheNode");
      }

      m_cacheNodesHasBeenSet = true;
    }
    XmlNode autoMinorVersionUpgradeNode = resultNode.FirstChild("AutoMinorVersionUpgrade");
    if(!autoMinorVersionUpgradeNode.IsNull())
    {
      m_autoMinorVersionUpgrade = StringUtils::ConvertToBool(StringUtils::Trim(autoMinorVersionUpgradeNode.GetText().c_str()).c_str());
      m_autoMinorVersionUpgradeHasBeenSet = true;
    }
    XmlNode securityGroupsNode = resultNode.FirstChild("SecurityGroups");
    if(!securityGroupsNode.IsNull())
    {
      XmlNode securityGroupsMember = securityGroupsNode.FirstChild("member");
      while(!securityGroupsMember.IsNull())
      {
        m_securityGroups.push_back(securityGroupsMember);
        securityGroupsMember = securityGroupsMember.NextNode("member");
      }

      m_securityGroupsHasBeenSet = true;
    }
    XmlNode replicationGroupIdNode = resultNode.FirstChild("ReplicationGroupId");
    if(!replicationGroupIdNode.IsNull())
    {
      m_replicationGroupId = StringUtils::Trim(replicationGroupIdNode.GetText().c_str());
      m_replicationGroupIdHasBeenSet = true;
    }
    XmlNode snapshotRetentionLimitNode = resultNode.FirstChild("SnapshotRetentionLimit");
    if(!snapshotRetentionLimitNode.IsNull())
    {
      m_snapshotRetentionLimit = StringUtils::ConvertToInt32(StringUtils::Trim(snapshotRetentionLimitNode.GetText().c_str()).c_str());
      m_snapshotRetentionLimitHasBeenSet = true;
    }
    XmlNode snapshotWindowNode = resultNode.FirstChild("SnapshotWindow");
    if(!snapshotWindowNode.IsNull())
    {
      m_snapshotWindow = StringUtils::Trim(snapshotWindowNode.GetText().c_str());
      m_snapshotWindowHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 3
0
Array f_getdate(int64_t timestamp /* = TimeStamp::Current() */) {
  return DateTime(timestamp, false).toArray(DateTime::ArrayFormat::TimeMap);
}
Ejemplo n.º 4
0
DateTime DateTime::operator-(const TimeSpan& span) {
  return DateTime(unixtime()-span.totalseconds());
}
Ejemplo n.º 5
0
	DateTime DateTime::Now()
	{
		return DateTime(time(NULL));
	}
Ejemplo n.º 6
0
DateTime DateTime::Parse(const StringRef& strDateTime, const StringRef& format, bool isUTC/*=true*/)
{
	return DateTime(strDateTime, format, isUTC);
}
Ejemplo n.º 7
0
Variant f_strftime(CStrRef format,
                   int64_t timestamp /* = TimeStamp::Current() */) {
  String ret = DateTime(timestamp, false).toString(format, true);
  if (ret.isNull()) return false;
  return ret;
}
Ejemplo n.º 8
0
DateTime zDBBinaryReader::ToDateTime(int offset)
{
	CHECK_DISPOSED(m_disposed);
	return DateTime(ToInt64(offset));		// Use ToInt64() instead
}
Ejemplo n.º 9
0
	void printData(DateTime now)
	{
		//Acquire data
		float temperature, humidity, pressure;
		temperature = HW::getTemperature();
		humidity = HW::getHumidity();
		pressure = HW::getPressure();
		int light = HW::getLight();
		
		LCD03::clear();
		
		if (now.year() == 2165)
			//Invalid date!
			now = DateTime( previous.unixtime() + 1000 );
		
		previous = now;

		print( now.year(), DEC );
		print('-');
		print( NumberUtil::fillNumber(now.month()) );
		print('-');
		print( NumberUtil::fillNumber(now.day()) );
		print(' ');
		print( NumberUtil::fillNumber(now.hour()) );
		print(':');
		print( NumberUtil::fillNumber(now.minute()) );
		print(':');
		print( NumberUtil::fillNumber(now.second()) );
		
		
		
		LCD03::print( now.year() );
		LCD03::print("-");
		LCD03::print( NumberUtil::fillNumber(now.month()) );
		LCD03::print("-");
		LCD03::print( NumberUtil::fillNumber(now.day()) );
		LCD03::print(" ");
		LCD03::print( NumberUtil::fillNumber(now.hour()) );
		LCD03::print(":");
		LCD03::print( NumberUtil::fillNumber(now.minute()) );
		LCD03::print(":");
		LCD03::print( NumberUtil::fillNumber(now.second()) );
		LCD03::println();

		print(';');
		
		print( temperature );
		LCD03::printFloat( temperature );
		LCD03::print(" C ");

		print(';');

		print( humidity );
		LCD03::printFloat( humidity );
		LCD03::print(" % ");

		LCD03::println();
		
		print(';');

		print( pressure );
		LCD03::printFloat( pressure );
		LCD03::print(" mbara ");
		
		print(';');

		print( light );
		print(';');

		printAudio();
		print(';');

		long geigerCount = HW::getGeiger();
		HW::resetGeiger();

		print( geigerCount );
		LCD03::print( geigerCount );
		LCD03::print(" cpx ");

		LCD03::println();

		print(';');

		printAxes();

		printGps();

		println();
	}
ScheduledUpdateGroupAction& ScheduledUpdateGroupAction::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode autoScalingGroupNameNode = resultNode.FirstChild("AutoScalingGroupName");
    if(!autoScalingGroupNameNode.IsNull())
    {
      m_autoScalingGroupName = StringUtils::Trim(autoScalingGroupNameNode.GetText().c_str());
      m_autoScalingGroupNameHasBeenSet = true;
    }
    XmlNode scheduledActionNameNode = resultNode.FirstChild("ScheduledActionName");
    if(!scheduledActionNameNode.IsNull())
    {
      m_scheduledActionName = StringUtils::Trim(scheduledActionNameNode.GetText().c_str());
      m_scheduledActionNameHasBeenSet = true;
    }
    XmlNode scheduledActionARNNode = resultNode.FirstChild("ScheduledActionARN");
    if(!scheduledActionARNNode.IsNull())
    {
      m_scheduledActionARN = StringUtils::Trim(scheduledActionARNNode.GetText().c_str());
      m_scheduledActionARNHasBeenSet = true;
    }
    XmlNode timeNode = resultNode.FirstChild("Time");
    if(!timeNode.IsNull())
    {
      m_time = DateTime(StringUtils::Trim(timeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_timeHasBeenSet = true;
    }
    XmlNode startTimeNode = resultNode.FirstChild("StartTime");
    if(!startTimeNode.IsNull())
    {
      m_startTime = DateTime(StringUtils::Trim(startTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_startTimeHasBeenSet = true;
    }
    XmlNode endTimeNode = resultNode.FirstChild("EndTime");
    if(!endTimeNode.IsNull())
    {
      m_endTime = DateTime(StringUtils::Trim(endTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_endTimeHasBeenSet = true;
    }
    XmlNode recurrenceNode = resultNode.FirstChild("Recurrence");
    if(!recurrenceNode.IsNull())
    {
      m_recurrence = StringUtils::Trim(recurrenceNode.GetText().c_str());
      m_recurrenceHasBeenSet = true;
    }
    XmlNode minSizeNode = resultNode.FirstChild("MinSize");
    if(!minSizeNode.IsNull())
    {
      m_minSize = StringUtils::ConvertToInt32(StringUtils::Trim(minSizeNode.GetText().c_str()).c_str());
      m_minSizeHasBeenSet = true;
    }
    XmlNode maxSizeNode = resultNode.FirstChild("MaxSize");
    if(!maxSizeNode.IsNull())
    {
      m_maxSize = StringUtils::ConvertToInt32(StringUtils::Trim(maxSizeNode.GetText().c_str()).c_str());
      m_maxSizeHasBeenSet = true;
    }
    XmlNode desiredCapacityNode = resultNode.FirstChild("DesiredCapacity");
    if(!desiredCapacityNode.IsNull())
    {
      m_desiredCapacity = StringUtils::ConvertToInt32(StringUtils::Trim(desiredCapacityNode.GetText().c_str()).c_str());
      m_desiredCapacityHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 11
0
Snapshot& Snapshot::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode snapshotIdNode = resultNode.FirstChild("snapshotId");
    if(!snapshotIdNode.IsNull())
    {
      m_snapshotId = StringUtils::Trim(snapshotIdNode.GetText().c_str());
      m_snapshotIdHasBeenSet = true;
    }
    XmlNode volumeIdNode = resultNode.FirstChild("volumeId");
    if(!volumeIdNode.IsNull())
    {
      m_volumeId = StringUtils::Trim(volumeIdNode.GetText().c_str());
      m_volumeIdHasBeenSet = true;
    }
    XmlNode stateNode = resultNode.FirstChild("status");
    if(!stateNode.IsNull())
    {
      m_state = SnapshotStateMapper::GetSnapshotStateForName(StringUtils::Trim(stateNode.GetText().c_str()).c_str());
      m_stateHasBeenSet = true;
    }
    XmlNode stateMessageNode = resultNode.FirstChild("statusMessage");
    if(!stateMessageNode.IsNull())
    {
      m_stateMessage = StringUtils::Trim(stateMessageNode.GetText().c_str());
      m_stateMessageHasBeenSet = true;
    }
    XmlNode startTimeNode = resultNode.FirstChild("startTime");
    if(!startTimeNode.IsNull())
    {
      m_startTime = DateTime(StringUtils::Trim(startTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_startTimeHasBeenSet = true;
    }
    XmlNode progressNode = resultNode.FirstChild("progress");
    if(!progressNode.IsNull())
    {
      m_progress = StringUtils::Trim(progressNode.GetText().c_str());
      m_progressHasBeenSet = true;
    }
    XmlNode ownerIdNode = resultNode.FirstChild("ownerId");
    if(!ownerIdNode.IsNull())
    {
      m_ownerId = StringUtils::Trim(ownerIdNode.GetText().c_str());
      m_ownerIdHasBeenSet = true;
    }
    XmlNode descriptionNode = resultNode.FirstChild("description");
    if(!descriptionNode.IsNull())
    {
      m_description = StringUtils::Trim(descriptionNode.GetText().c_str());
      m_descriptionHasBeenSet = true;
    }
    XmlNode volumeSizeNode = resultNode.FirstChild("volumeSize");
    if(!volumeSizeNode.IsNull())
    {
      m_volumeSize = StringUtils::ConvertToInt32(StringUtils::Trim(volumeSizeNode.GetText().c_str()).c_str());
      m_volumeSizeHasBeenSet = true;
    }
    XmlNode ownerAliasNode = resultNode.FirstChild("ownerAlias");
    if(!ownerAliasNode.IsNull())
    {
      m_ownerAlias = StringUtils::Trim(ownerAliasNode.GetText().c_str());
      m_ownerAliasHasBeenSet = true;
    }
    XmlNode tagsNode = resultNode.FirstChild("tagSet");
    if(!tagsNode.IsNull())
    {
      XmlNode tagsMember = tagsNode.FirstChild("item");
      while(!tagsMember.IsNull())
      {
        m_tags.push_back(tagsMember);
        tagsMember = tagsMember.NextNode("item");
      }

      m_tagsHasBeenSet = true;
    }
    XmlNode encryptedNode = resultNode.FirstChild("encrypted");
    if(!encryptedNode.IsNull())
    {
      m_encrypted = StringUtils::ConvertToBool(StringUtils::Trim(encryptedNode.GetText().c_str()).c_str());
      m_encryptedHasBeenSet = true;
    }
    XmlNode kmsKeyIdNode = resultNode.FirstChild("kmsKeyId");
    if(!kmsKeyIdNode.IsNull())
    {
      m_kmsKeyId = StringUtils::Trim(kmsKeyIdNode.GetText().c_str());
      m_kmsKeyIdHasBeenSet = true;
    }
    XmlNode dataEncryptionKeyIdNode = resultNode.FirstChild("dataEncryptionKeyId");
    if(!dataEncryptionKeyIdNode.IsNull())
    {
      m_dataEncryptionKeyId = StringUtils::Trim(dataEncryptionKeyIdNode.GetText().c_str());
      m_dataEncryptionKeyIdHasBeenSet = true;
    }
  }

  return *this;
}
LaunchConfiguration& LaunchConfiguration::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode launchConfigurationNameNode = resultNode.FirstChild("LaunchConfigurationName");
    if(!launchConfigurationNameNode.IsNull())
    {
      m_launchConfigurationName = StringUtils::Trim(launchConfigurationNameNode.GetText().c_str());
      m_launchConfigurationNameHasBeenSet = true;
    }
    XmlNode launchConfigurationARNNode = resultNode.FirstChild("LaunchConfigurationARN");
    if(!launchConfigurationARNNode.IsNull())
    {
      m_launchConfigurationARN = StringUtils::Trim(launchConfigurationARNNode.GetText().c_str());
      m_launchConfigurationARNHasBeenSet = true;
    }
    XmlNode imageIdNode = resultNode.FirstChild("ImageId");
    if(!imageIdNode.IsNull())
    {
      m_imageId = StringUtils::Trim(imageIdNode.GetText().c_str());
      m_imageIdHasBeenSet = true;
    }
    XmlNode keyNameNode = resultNode.FirstChild("KeyName");
    if(!keyNameNode.IsNull())
    {
      m_keyName = StringUtils::Trim(keyNameNode.GetText().c_str());
      m_keyNameHasBeenSet = true;
    }
    XmlNode securityGroupsNode = resultNode.FirstChild("SecurityGroups");
    if(!securityGroupsNode.IsNull())
    {
      XmlNode securityGroupsMember = securityGroupsNode.FirstChild("member");
      while(!securityGroupsMember.IsNull())
      {
        m_securityGroups.push_back(StringUtils::Trim(securityGroupsMember.GetText().c_str()));
        securityGroupsMember = securityGroupsMember.NextNode("member");
      }

      m_securityGroupsHasBeenSet = true;
    }
    XmlNode classicLinkVPCIdNode = resultNode.FirstChild("ClassicLinkVPCId");
    if(!classicLinkVPCIdNode.IsNull())
    {
      m_classicLinkVPCId = StringUtils::Trim(classicLinkVPCIdNode.GetText().c_str());
      m_classicLinkVPCIdHasBeenSet = true;
    }
    XmlNode classicLinkVPCSecurityGroupsNode = resultNode.FirstChild("ClassicLinkVPCSecurityGroups");
    if(!classicLinkVPCSecurityGroupsNode.IsNull())
    {
      XmlNode classicLinkVPCSecurityGroupsMember = classicLinkVPCSecurityGroupsNode.FirstChild("member");
      while(!classicLinkVPCSecurityGroupsMember.IsNull())
      {
        m_classicLinkVPCSecurityGroups.push_back(StringUtils::Trim(classicLinkVPCSecurityGroupsMember.GetText().c_str()));
        classicLinkVPCSecurityGroupsMember = classicLinkVPCSecurityGroupsMember.NextNode("member");
      }

      m_classicLinkVPCSecurityGroupsHasBeenSet = true;
    }
    XmlNode userDataNode = resultNode.FirstChild("UserData");
    if(!userDataNode.IsNull())
    {
      m_userData = StringUtils::Trim(userDataNode.GetText().c_str());
      m_userDataHasBeenSet = true;
    }
    XmlNode instanceTypeNode = resultNode.FirstChild("InstanceType");
    if(!instanceTypeNode.IsNull())
    {
      m_instanceType = StringUtils::Trim(instanceTypeNode.GetText().c_str());
      m_instanceTypeHasBeenSet = true;
    }
    XmlNode kernelIdNode = resultNode.FirstChild("KernelId");
    if(!kernelIdNode.IsNull())
    {
      m_kernelId = StringUtils::Trim(kernelIdNode.GetText().c_str());
      m_kernelIdHasBeenSet = true;
    }
    XmlNode ramdiskIdNode = resultNode.FirstChild("RamdiskId");
    if(!ramdiskIdNode.IsNull())
    {
      m_ramdiskId = StringUtils::Trim(ramdiskIdNode.GetText().c_str());
      m_ramdiskIdHasBeenSet = true;
    }
    XmlNode blockDeviceMappingsNode = resultNode.FirstChild("BlockDeviceMappings");
    if(!blockDeviceMappingsNode.IsNull())
    {
      XmlNode blockDeviceMappingsMember = blockDeviceMappingsNode.FirstChild("member");
      while(!blockDeviceMappingsMember.IsNull())
      {
        m_blockDeviceMappings.push_back(blockDeviceMappingsMember);
        blockDeviceMappingsMember = blockDeviceMappingsMember.NextNode("member");
      }

      m_blockDeviceMappingsHasBeenSet = true;
    }
    XmlNode instanceMonitoringNode = resultNode.FirstChild("InstanceMonitoring");
    if(!instanceMonitoringNode.IsNull())
    {
      m_instanceMonitoring = instanceMonitoringNode;
      m_instanceMonitoringHasBeenSet = true;
    }
    XmlNode spotPriceNode = resultNode.FirstChild("SpotPrice");
    if(!spotPriceNode.IsNull())
    {
      m_spotPrice = StringUtils::Trim(spotPriceNode.GetText().c_str());
      m_spotPriceHasBeenSet = true;
    }
    XmlNode iamInstanceProfileNode = resultNode.FirstChild("IamInstanceProfile");
    if(!iamInstanceProfileNode.IsNull())
    {
      m_iamInstanceProfile = StringUtils::Trim(iamInstanceProfileNode.GetText().c_str());
      m_iamInstanceProfileHasBeenSet = true;
    }
    XmlNode createdTimeNode = resultNode.FirstChild("CreatedTime");
    if(!createdTimeNode.IsNull())
    {
      m_createdTime = DateTime(StringUtils::Trim(createdTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_createdTimeHasBeenSet = true;
    }
    XmlNode ebsOptimizedNode = resultNode.FirstChild("EbsOptimized");
    if(!ebsOptimizedNode.IsNull())
    {
      m_ebsOptimized = StringUtils::ConvertToBool(StringUtils::Trim(ebsOptimizedNode.GetText().c_str()).c_str());
      m_ebsOptimizedHasBeenSet = true;
    }
    XmlNode associatePublicIpAddressNode = resultNode.FirstChild("AssociatePublicIpAddress");
    if(!associatePublicIpAddressNode.IsNull())
    {
      m_associatePublicIpAddress = StringUtils::ConvertToBool(StringUtils::Trim(associatePublicIpAddressNode.GetText().c_str()).c_str());
      m_associatePublicIpAddressHasBeenSet = true;
    }
    XmlNode placementTenancyNode = resultNode.FirstChild("PlacementTenancy");
    if(!placementTenancyNode.IsNull())
    {
      m_placementTenancy = StringUtils::Trim(placementTenancyNode.GetText().c_str());
      m_placementTenancyHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 13
0
Snapshot& Snapshot::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode snapshotNameNode = resultNode.FirstChild("SnapshotName");
    if(!snapshotNameNode.IsNull())
    {
      m_snapshotName = StringUtils::Trim(snapshotNameNode.GetText().c_str());
      m_snapshotNameHasBeenSet = true;
    }
    XmlNode cacheClusterIdNode = resultNode.FirstChild("CacheClusterId");
    if(!cacheClusterIdNode.IsNull())
    {
      m_cacheClusterId = StringUtils::Trim(cacheClusterIdNode.GetText().c_str());
      m_cacheClusterIdHasBeenSet = true;
    }
    XmlNode snapshotStatusNode = resultNode.FirstChild("SnapshotStatus");
    if(!snapshotStatusNode.IsNull())
    {
      m_snapshotStatus = StringUtils::Trim(snapshotStatusNode.GetText().c_str());
      m_snapshotStatusHasBeenSet = true;
    }
    XmlNode snapshotSourceNode = resultNode.FirstChild("SnapshotSource");
    if(!snapshotSourceNode.IsNull())
    {
      m_snapshotSource = StringUtils::Trim(snapshotSourceNode.GetText().c_str());
      m_snapshotSourceHasBeenSet = true;
    }
    XmlNode cacheNodeTypeNode = resultNode.FirstChild("CacheNodeType");
    if(!cacheNodeTypeNode.IsNull())
    {
      m_cacheNodeType = StringUtils::Trim(cacheNodeTypeNode.GetText().c_str());
      m_cacheNodeTypeHasBeenSet = true;
    }
    XmlNode engineNode = resultNode.FirstChild("Engine");
    if(!engineNode.IsNull())
    {
      m_engine = StringUtils::Trim(engineNode.GetText().c_str());
      m_engineHasBeenSet = true;
    }
    XmlNode engineVersionNode = resultNode.FirstChild("EngineVersion");
    if(!engineVersionNode.IsNull())
    {
      m_engineVersion = StringUtils::Trim(engineVersionNode.GetText().c_str());
      m_engineVersionHasBeenSet = true;
    }
    XmlNode numCacheNodesNode = resultNode.FirstChild("NumCacheNodes");
    if(!numCacheNodesNode.IsNull())
    {
      m_numCacheNodes = StringUtils::ConvertToInt32(StringUtils::Trim(numCacheNodesNode.GetText().c_str()).c_str());
      m_numCacheNodesHasBeenSet = true;
    }
    XmlNode preferredAvailabilityZoneNode = resultNode.FirstChild("PreferredAvailabilityZone");
    if(!preferredAvailabilityZoneNode.IsNull())
    {
      m_preferredAvailabilityZone = StringUtils::Trim(preferredAvailabilityZoneNode.GetText().c_str());
      m_preferredAvailabilityZoneHasBeenSet = true;
    }
    XmlNode cacheClusterCreateTimeNode = resultNode.FirstChild("CacheClusterCreateTime");
    if(!cacheClusterCreateTimeNode.IsNull())
    {
      m_cacheClusterCreateTime = DateTime(StringUtils::Trim(cacheClusterCreateTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_cacheClusterCreateTimeHasBeenSet = true;
    }
    XmlNode preferredMaintenanceWindowNode = resultNode.FirstChild("PreferredMaintenanceWindow");
    if(!preferredMaintenanceWindowNode.IsNull())
    {
      m_preferredMaintenanceWindow = StringUtils::Trim(preferredMaintenanceWindowNode.GetText().c_str());
      m_preferredMaintenanceWindowHasBeenSet = true;
    }
    XmlNode topicArnNode = resultNode.FirstChild("TopicArn");
    if(!topicArnNode.IsNull())
    {
      m_topicArn = StringUtils::Trim(topicArnNode.GetText().c_str());
      m_topicArnHasBeenSet = true;
    }
    XmlNode portNode = resultNode.FirstChild("Port");
    if(!portNode.IsNull())
    {
      m_port = StringUtils::ConvertToInt32(StringUtils::Trim(portNode.GetText().c_str()).c_str());
      m_portHasBeenSet = true;
    }
    XmlNode cacheParameterGroupNameNode = resultNode.FirstChild("CacheParameterGroupName");
    if(!cacheParameterGroupNameNode.IsNull())
    {
      m_cacheParameterGroupName = StringUtils::Trim(cacheParameterGroupNameNode.GetText().c_str());
      m_cacheParameterGroupNameHasBeenSet = true;
    }
    XmlNode cacheSubnetGroupNameNode = resultNode.FirstChild("CacheSubnetGroupName");
    if(!cacheSubnetGroupNameNode.IsNull())
    {
      m_cacheSubnetGroupName = StringUtils::Trim(cacheSubnetGroupNameNode.GetText().c_str());
      m_cacheSubnetGroupNameHasBeenSet = true;
    }
    XmlNode vpcIdNode = resultNode.FirstChild("VpcId");
    if(!vpcIdNode.IsNull())
    {
      m_vpcId = StringUtils::Trim(vpcIdNode.GetText().c_str());
      m_vpcIdHasBeenSet = true;
    }
    XmlNode autoMinorVersionUpgradeNode = resultNode.FirstChild("AutoMinorVersionUpgrade");
    if(!autoMinorVersionUpgradeNode.IsNull())
    {
      m_autoMinorVersionUpgrade = StringUtils::ConvertToBool(StringUtils::Trim(autoMinorVersionUpgradeNode.GetText().c_str()).c_str());
      m_autoMinorVersionUpgradeHasBeenSet = true;
    }
    XmlNode snapshotRetentionLimitNode = resultNode.FirstChild("SnapshotRetentionLimit");
    if(!snapshotRetentionLimitNode.IsNull())
    {
      m_snapshotRetentionLimit = StringUtils::ConvertToInt32(StringUtils::Trim(snapshotRetentionLimitNode.GetText().c_str()).c_str());
      m_snapshotRetentionLimitHasBeenSet = true;
    }
    XmlNode snapshotWindowNode = resultNode.FirstChild("SnapshotWindow");
    if(!snapshotWindowNode.IsNull())
    {
      m_snapshotWindow = StringUtils::Trim(snapshotWindowNode.GetText().c_str());
      m_snapshotWindowHasBeenSet = true;
    }
    XmlNode nodeSnapshotsNode = resultNode.FirstChild("NodeSnapshots");
    if(!nodeSnapshotsNode.IsNull())
    {
      XmlNode nodeSnapshotsMember = nodeSnapshotsNode.FirstChild("NodeSnapshot");
      while(!nodeSnapshotsMember.IsNull())
      {
        m_nodeSnapshots.push_back(nodeSnapshotsMember);
        nodeSnapshotsMember = nodeSnapshotsMember.NextNode("NodeSnapshot");
      }

      m_nodeSnapshotsHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 14
0
FlowLog& FlowLog::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode creationTimeNode = resultNode.FirstChild("creationTime");
    if(!creationTimeNode.IsNull())
    {
      m_creationTime = DateTime(StringUtils::Trim(creationTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_creationTimeHasBeenSet = true;
    }
    XmlNode deliverLogsErrorMessageNode = resultNode.FirstChild("deliverLogsErrorMessage");
    if(!deliverLogsErrorMessageNode.IsNull())
    {
      m_deliverLogsErrorMessage = StringUtils::Trim(deliverLogsErrorMessageNode.GetText().c_str());
      m_deliverLogsErrorMessageHasBeenSet = true;
    }
    XmlNode deliverLogsPermissionArnNode = resultNode.FirstChild("deliverLogsPermissionArn");
    if(!deliverLogsPermissionArnNode.IsNull())
    {
      m_deliverLogsPermissionArn = StringUtils::Trim(deliverLogsPermissionArnNode.GetText().c_str());
      m_deliverLogsPermissionArnHasBeenSet = true;
    }
    XmlNode deliverLogsStatusNode = resultNode.FirstChild("deliverLogsStatus");
    if(!deliverLogsStatusNode.IsNull())
    {
      m_deliverLogsStatus = StringUtils::Trim(deliverLogsStatusNode.GetText().c_str());
      m_deliverLogsStatusHasBeenSet = true;
    }
    XmlNode flowLogIdNode = resultNode.FirstChild("flowLogId");
    if(!flowLogIdNode.IsNull())
    {
      m_flowLogId = StringUtils::Trim(flowLogIdNode.GetText().c_str());
      m_flowLogIdHasBeenSet = true;
    }
    XmlNode flowLogStatusNode = resultNode.FirstChild("flowLogStatus");
    if(!flowLogStatusNode.IsNull())
    {
      m_flowLogStatus = StringUtils::Trim(flowLogStatusNode.GetText().c_str());
      m_flowLogStatusHasBeenSet = true;
    }
    XmlNode logGroupNameNode = resultNode.FirstChild("logGroupName");
    if(!logGroupNameNode.IsNull())
    {
      m_logGroupName = StringUtils::Trim(logGroupNameNode.GetText().c_str());
      m_logGroupNameHasBeenSet = true;
    }
    XmlNode resourceIdNode = resultNode.FirstChild("resourceId");
    if(!resourceIdNode.IsNull())
    {
      m_resourceId = StringUtils::Trim(resourceIdNode.GetText().c_str());
      m_resourceIdHasBeenSet = true;
    }
    XmlNode trafficTypeNode = resultNode.FirstChild("trafficType");
    if(!trafficTypeNode.IsNull())
    {
      m_trafficType = TrafficTypeMapper::GetTrafficTypeForName(StringUtils::Trim(trafficTypeNode.GetText().c_str()).c_str());
      m_trafficTypeHasBeenSet = true;
    }
    XmlNode logDestinationTypeNode = resultNode.FirstChild("logDestinationType");
    if(!logDestinationTypeNode.IsNull())
    {
      m_logDestinationType = LogDestinationTypeMapper::GetLogDestinationTypeForName(StringUtils::Trim(logDestinationTypeNode.GetText().c_str()).c_str());
      m_logDestinationTypeHasBeenSet = true;
    }
    XmlNode logDestinationNode = resultNode.FirstChild("logDestination");
    if(!logDestinationNode.IsNull())
    {
      m_logDestination = StringUtils::Trim(logDestinationNode.GetText().c_str());
      m_logDestinationHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 15
0
DateTime DateTime::Now()
{
	return DateTime(std::chrono::system_clock::now(), false);
}
Ejemplo n.º 16
0
namespace CSV
{
	Print* output;

	void setPrinter(Print* p)
	{
		output = p;
	}
	
	void println()
	{
		output->println();
		Serial.println();
	}
	
	void print(uint16_t n, int d)
	{
		output->print(n,d);
		Serial.print(n,d);
	}
	
	void print(const __FlashStringHelper* f)
	{
		output->print(f);
		Serial.print(f);
	}
	
	void print(char c)
	{
		output->print(c);
		Serial.print(c);
	}
	
	void print(int i)
	{
		output->print(i);
		Serial.print(i);
	}
	
	void print(uint16_t i)
	{
		output->print(i);
		Serial.print(i);
	}
	
	void print(const char* c)
	{
		output->print(c);
		Serial.print(c);
	}

	void print(float f)
	{
		output->print(f);
		Serial.print(f);
	}

	void print(long l)
	{
		output->print(l);
		Serial.print(l);
	}


	void printHead()
	{
		print( F("date;temperature;humidity;pressure;light;audio;geiger;") );

		print( F("accelx;accely;accelz;compassx;compassy;compassz;gyrox;gyroy;gyroz;") );

		//http://de.wikipedia.org/wiki/NMEA_0183
		print( F("gpstime;latitude;NS;longitude;EW;quality;satellites;dilution;msl;altitude;gg;aa;rrrr") );
		println();
	}

	const int BUFFER_LEN = 400;
	uint16_t buffer[BUFFER_LEN];

	void printAudio()
	{
		long start = millis();

		//Store
		for (int i=0; i<BUFFER_LEN; i++)
			buffer[i] = analogRead(MICROPHONE_PIN);

		long diff = millis() - start;	

		//Forward
		print( F("{\"samples\":[") );
		for (int i=0; i<BUFFER_LEN; i++)
		{
			int j = buffer[i];
			j -= 512;
			print(j);

			if (i<BUFFER_LEN-1)
				print(',');
		}
		print( F("],\"time\":") );
		print( diff );
		print( F("}") );
	}

	void printGps()
	{
		char* gpsStr = GPS::getData();
		gpsStr++;
		
		for (uint8_t i=0; i<strlen(gpsStr); i++)
			if (gpsStr[i] == ',')
				gpsStr[i] = ';';
		
		print(gpsStr);
		
		gpsStr[19] = 0x00;
		LCD03::print(gpsStr);
	}

	void printAxes()
	{
		Serial2.println("get");

		delay(50);

		while(Serial2.available() > 0)
			print((char)Serial2.read());
	}

	DateTime previous = DateTime(0);

	void printData(DateTime now)
	{
		//Acquire data
		float temperature, humidity, pressure;
		temperature = HW::getTemperature();
		humidity = HW::getHumidity();
		pressure = HW::getPressure();
		int light = HW::getLight();
		
		LCD03::clear();
		
		if (now.year() == 2165)
			//Invalid date!
			now = DateTime( previous.unixtime() + 1000 );
		
		previous = now;

		print( now.year(), DEC );
		print('-');
		print( NumberUtil::fillNumber(now.month()) );
		print('-');
		print( NumberUtil::fillNumber(now.day()) );
		print(' ');
		print( NumberUtil::fillNumber(now.hour()) );
		print(':');
		print( NumberUtil::fillNumber(now.minute()) );
		print(':');
		print( NumberUtil::fillNumber(now.second()) );
		
		
		
		LCD03::print( now.year() );
		LCD03::print("-");
		LCD03::print( NumberUtil::fillNumber(now.month()) );
		LCD03::print("-");
		LCD03::print( NumberUtil::fillNumber(now.day()) );
		LCD03::print(" ");
		LCD03::print( NumberUtil::fillNumber(now.hour()) );
		LCD03::print(":");
		LCD03::print( NumberUtil::fillNumber(now.minute()) );
		LCD03::print(":");
		LCD03::print( NumberUtil::fillNumber(now.second()) );
		LCD03::println();

		print(';');
		
		print( temperature );
		LCD03::printFloat( temperature );
		LCD03::print(" C ");

		print(';');

		print( humidity );
		LCD03::printFloat( humidity );
		LCD03::print(" % ");

		LCD03::println();
		
		print(';');

		print( pressure );
		LCD03::printFloat( pressure );
		LCD03::print(" mbara ");
		
		print(';');

		print( light );
		print(';');

		printAudio();
		print(';');

		long geigerCount = HW::getGeiger();
		HW::resetGeiger();

		print( geigerCount );
		LCD03::print( geigerCount );
		LCD03::print(" cpx ");

		LCD03::println();

		print(';');

		printAxes();

		printGps();

		println();
	}
};
Ejemplo n.º 17
0
DateTime DateTime::UTCNow()
{
	auto result = DateTime(std::chrono::system_clock::now(), false);
	result.ConvertToUTC();
	return result;
}
SpotInstanceRequest& SpotInstanceRequest::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode spotInstanceRequestIdNode = resultNode.FirstChild("spotInstanceRequestId");
    if(!spotInstanceRequestIdNode.IsNull())
    {
      m_spotInstanceRequestId = StringUtils::Trim(spotInstanceRequestIdNode.GetText().c_str());
      m_spotInstanceRequestIdHasBeenSet = true;
    }
    XmlNode spotPriceNode = resultNode.FirstChild("spotPrice");
    if(!spotPriceNode.IsNull())
    {
      m_spotPrice = StringUtils::Trim(spotPriceNode.GetText().c_str());
      m_spotPriceHasBeenSet = true;
    }
    XmlNode typeNode = resultNode.FirstChild("type");
    if(!typeNode.IsNull())
    {
      m_type = SpotInstanceTypeMapper::GetSpotInstanceTypeForName(StringUtils::Trim(typeNode.GetText().c_str()).c_str());
      m_typeHasBeenSet = true;
    }
    XmlNode stateNode = resultNode.FirstChild("state");
    if(!stateNode.IsNull())
    {
      m_state = SpotInstanceStateMapper::GetSpotInstanceStateForName(StringUtils::Trim(stateNode.GetText().c_str()).c_str());
      m_stateHasBeenSet = true;
    }
    XmlNode faultNode = resultNode.FirstChild("fault");
    if(!faultNode.IsNull())
    {
      m_fault = faultNode;
      m_faultHasBeenSet = true;
    }
    XmlNode statusNode = resultNode.FirstChild("status");
    if(!statusNode.IsNull())
    {
      m_status = statusNode;
      m_statusHasBeenSet = true;
    }
    XmlNode validFromNode = resultNode.FirstChild("validFrom");
    if(!validFromNode.IsNull())
    {
      m_validFrom = DateTime(StringUtils::Trim(validFromNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_validFromHasBeenSet = true;
    }
    XmlNode validUntilNode = resultNode.FirstChild("validUntil");
    if(!validUntilNode.IsNull())
    {
      m_validUntil = DateTime(StringUtils::Trim(validUntilNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_validUntilHasBeenSet = true;
    }
    XmlNode launchGroupNode = resultNode.FirstChild("launchGroup");
    if(!launchGroupNode.IsNull())
    {
      m_launchGroup = StringUtils::Trim(launchGroupNode.GetText().c_str());
      m_launchGroupHasBeenSet = true;
    }
    XmlNode availabilityZoneGroupNode = resultNode.FirstChild("availabilityZoneGroup");
    if(!availabilityZoneGroupNode.IsNull())
    {
      m_availabilityZoneGroup = StringUtils::Trim(availabilityZoneGroupNode.GetText().c_str());
      m_availabilityZoneGroupHasBeenSet = true;
    }
    XmlNode launchSpecificationNode = resultNode.FirstChild("launchSpecification");
    if(!launchSpecificationNode.IsNull())
    {
      m_launchSpecification = launchSpecificationNode;
      m_launchSpecificationHasBeenSet = true;
    }
    XmlNode instanceIdNode = resultNode.FirstChild("instanceId");
    if(!instanceIdNode.IsNull())
    {
      m_instanceId = StringUtils::Trim(instanceIdNode.GetText().c_str());
      m_instanceIdHasBeenSet = true;
    }
    XmlNode createTimeNode = resultNode.FirstChild("createTime");
    if(!createTimeNode.IsNull())
    {
      m_createTime = DateTime(StringUtils::Trim(createTimeNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_createTimeHasBeenSet = true;
    }
    XmlNode productDescriptionNode = resultNode.FirstChild("productDescription");
    if(!productDescriptionNode.IsNull())
    {
      m_productDescription = RIProductDescriptionMapper::GetRIProductDescriptionForName(StringUtils::Trim(productDescriptionNode.GetText().c_str()).c_str());
      m_productDescriptionHasBeenSet = true;
    }
    XmlNode blockDurationMinutesNode = resultNode.FirstChild("blockDurationMinutes");
    if(!blockDurationMinutesNode.IsNull())
    {
      m_blockDurationMinutes = StringUtils::ConvertToInt32(StringUtils::Trim(blockDurationMinutesNode.GetText().c_str()).c_str());
      m_blockDurationMinutesHasBeenSet = true;
    }
    XmlNode actualBlockHourlyPriceNode = resultNode.FirstChild("actualBlockHourlyPrice");
    if(!actualBlockHourlyPriceNode.IsNull())
    {
      m_actualBlockHourlyPrice = StringUtils::Trim(actualBlockHourlyPriceNode.GetText().c_str());
      m_actualBlockHourlyPriceHasBeenSet = true;
    }
    XmlNode tagsNode = resultNode.FirstChild("tagSet");
    if(!tagsNode.IsNull())
    {
      XmlNode tagsMember = tagsNode.FirstChild("item");
      while(!tagsMember.IsNull())
      {
        m_tags.push_back(tagsMember);
        tagsMember = tagsMember.NextNode("item");
      }

      m_tagsHasBeenSet = true;
    }
    XmlNode launchedAvailabilityZoneNode = resultNode.FirstChild("launchedAvailabilityZone");
    if(!launchedAvailabilityZoneNode.IsNull())
    {
      m_launchedAvailabilityZone = StringUtils::Trim(launchedAvailabilityZoneNode.GetText().c_str());
      m_launchedAvailabilityZoneHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 19
0
Variant f_date(CStrRef format, int64_t timestamp /* = TimeStamp::Current() */) {
  if (format.empty()) return "";
  String ret = DateTime(timestamp, false).toString(format, false);
  if (ret.isNull()) return false;
  return ret;
}
Ejemplo n.º 20
0
// Constructores
DataColaborador::DataColaborador(){
    setCarpeta(DataCarpeta());
	setFecha(DateTime());
}
Ejemplo n.º 21
0
Array f_localtime(int64_t timestamp /* = TimeStamp::Current() */,
                  bool is_associative /* = false */) {
  DateTime::ArrayFormat format =
    is_associative ? DateTime::TmMap : DateTime::TmVector;
  return DateTime(timestamp, false).toArray(format);
}
Ejemplo n.º 22
0
FText FText::AsTime(const FDateTime::FTime& Time, const EDateTimeStyle::Type TimeStyle, const FString& TimeZone, const TSharedPtr<FCulture>& TargetCulture)
{
	checkf(FInternationalization::IsInitialized() == true, TEXT("FInternationalization is not initialized. An FText formatting method was likely used in static object initialization - this is not supported."));
	FDateTime DateTime(1, 1, 1, Time.Hour, Time.Minute, Time.Second, Time.Millisecond);
	return FText::FromString( DateTime.ToString( TEXT("%H.%M.%S") ) );
}
Ejemplo n.º 23
0
bool Transport::setCookie(CStrRef name, CStrRef value, int64 expire /* = 0 */,
                          CStrRef path /* = "" */, CStrRef domain /* = "" */,
                          bool secure /* = false */,
                          bool httponly /* = false */,
                          bool encode_url /* = true */) {
  if (!name.empty() && strpbrk(name.data(), "=,; \t\r\n\013\014")) {
    Logger::Warning("Cookie names can not contain any of the following "
                    "'=,; \\t\\r\\n\\013\\014'");
    return false;
  }

  if (!encode_url &&
      !value.empty() && strpbrk(value.data(), ",; \t\r\n\013\014")) {
    Logger::Warning("Cookie values can not contain any of the following "
                    "',; \\t\\r\\n\\013\\014'");
    return false;
  }

  char *encoded_value = NULL;
  int len = 0;
  if (!value.empty() && encode_url) {
    int encoded_value_len = value.size();
    encoded_value = url_encode(value.data(), encoded_value_len);
    len += encoded_value_len;
  } else if (!value.empty()) {
    encoded_value = strdup(value.data());
    len += value.size();
  }
  len += path.size();
  len += domain.size();

  std::string cookie;
  cookie.reserve(len + 100);
  if (value.empty()) {
    /*
     * MSIE doesn't delete a cookie when you set it to a null value
     * so in order to force cookies to be deleted, even on MSIE, we
     * pick an expiry date 1 year and 1 second in the past
     */
    String sdt = DateTime(time(NULL) - 31536001, true)
      .toString(DateTime::Cookie);
    cookie += name.data();
    cookie += "=deleted; expires=";
    cookie += sdt.data();
  } else {
    cookie += name.data();
    cookie += "=";
    cookie += encoded_value ? encoded_value : "";
    if (expire > 0) {
      if (expire > 253402300799LL) {
        raise_warning("Expiry date cannot have a year greater then 9999");
        return false;
      }
      cookie += "; expires=";
      String sdt = DateTime(expire, true).toString(DateTime::Cookie);
      cookie += sdt.data();
    }
  }

  if (encoded_value) {
    free(encoded_value);
  }

  if (!path.empty()) {
    cookie += "; path=";
    cookie += path.data();
  }
  if (!domain.empty()) {
    cookie += "; domain=";
    cookie += domain.data();
  }
  if (secure) {
    cookie += "; secure";
  }
  if (httponly) {
    cookie += "; httponly";
  }

  FiberWriteLock lock(this);
  m_responseCookies[name.data()] = cookie;
  return true;
}
Ejemplo n.º 24
0
FText FText::AsTime(const FTimespan& Time, const TSharedPtr<FCulture>& TargetCulture)
{
	checkf(FInternationalization::IsInitialized() == true, TEXT("FInternationalization is not initialized. An FText formatting method was likely used in static object initialization - this is not supported."));
	FDateTime DateTime(Time.GetTicks());
	return FText::FromString( DateTime.ToString( TEXT("%H.%M.%S") ) );
}
Ejemplo n.º 25
0
Policy& Policy::operator =(const XmlNode& xmlNode)
{
  XmlNode resultNode = xmlNode;

  if(!resultNode.IsNull())
  {
    XmlNode policyNameNode = resultNode.FirstChild("PolicyName");
    if(!policyNameNode.IsNull())
    {
      m_policyName = StringUtils::Trim(policyNameNode.GetText().c_str());
      m_policyNameHasBeenSet = true;
    }
    XmlNode policyIdNode = resultNode.FirstChild("PolicyId");
    if(!policyIdNode.IsNull())
    {
      m_policyId = StringUtils::Trim(policyIdNode.GetText().c_str());
      m_policyIdHasBeenSet = true;
    }
    XmlNode arnNode = resultNode.FirstChild("Arn");
    if(!arnNode.IsNull())
    {
      m_arn = StringUtils::Trim(arnNode.GetText().c_str());
      m_arnHasBeenSet = true;
    }
    XmlNode pathNode = resultNode.FirstChild("Path");
    if(!pathNode.IsNull())
    {
      m_path = StringUtils::Trim(pathNode.GetText().c_str());
      m_pathHasBeenSet = true;
    }
    XmlNode defaultVersionIdNode = resultNode.FirstChild("DefaultVersionId");
    if(!defaultVersionIdNode.IsNull())
    {
      m_defaultVersionId = StringUtils::Trim(defaultVersionIdNode.GetText().c_str());
      m_defaultVersionIdHasBeenSet = true;
    }
    XmlNode attachmentCountNode = resultNode.FirstChild("AttachmentCount");
    if(!attachmentCountNode.IsNull())
    {
      m_attachmentCount = StringUtils::ConvertToInt32(StringUtils::Trim(attachmentCountNode.GetText().c_str()).c_str());
      m_attachmentCountHasBeenSet = true;
    }
    XmlNode isAttachableNode = resultNode.FirstChild("IsAttachable");
    if(!isAttachableNode.IsNull())
    {
      m_isAttachable = StringUtils::ConvertToBool(StringUtils::Trim(isAttachableNode.GetText().c_str()).c_str());
      m_isAttachableHasBeenSet = true;
    }
    XmlNode descriptionNode = resultNode.FirstChild("Description");
    if(!descriptionNode.IsNull())
    {
      m_description = StringUtils::Trim(descriptionNode.GetText().c_str());
      m_descriptionHasBeenSet = true;
    }
    XmlNode createDateNode = resultNode.FirstChild("CreateDate");
    if(!createDateNode.IsNull())
    {
      m_createDate = DateTime(StringUtils::Trim(createDateNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_createDateHasBeenSet = true;
    }
    XmlNode updateDateNode = resultNode.FirstChild("UpdateDate");
    if(!updateDateNode.IsNull())
    {
      m_updateDate = DateTime(StringUtils::Trim(updateDateNode.GetText().c_str()).c_str(), DateFormat::ISO_8601);
      m_updateDateHasBeenSet = true;
    }
  }

  return *this;
}
Ejemplo n.º 26
0
FText FText::AsDate(const FDateTime::FDate& Date, const EDateTimeStyle::Type DateStyle, const TSharedPtr<FCulture>& TargetCulture)
{
	checkf(FInternationalization::IsInitialized() == true, TEXT("FInternationalization is not initialized. An FText formatting method was likely used in static object initialization - this is not supported."));
	FDateTime DateTime(Date.Year, Date.Month, Date.Day);
	return FText::FromString( DateTime.ToString( TEXT("%Y.%m.%d") ) );
}
Ejemplo n.º 27
0
String f_gmstrftime(const String& format,
                    int64_t timestamp /* = TimeStamp::Current() */) {
  String ret = DateTime(timestamp, true).toString(format, true);
  if (ret.isNull()) return false;
  return ret;
}
Ejemplo n.º 28
0
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#include "MedusaCorePreCompiled.h"
#include "Core/Chrono/DateTime.h"
#include "Core/String/StringParser.h"
#include "Core/Log/Log.h"
#include "Core/String/Format/Format.h"

#ifdef MEDUSA_WINDOWS
#include <WinSock2.h>
#endif

MEDUSA_BEGIN;


const DateTime DateTime::StartDate = DateTime(std::chrono::system_clock::from_time_t(0));

DateTime::DateTime() 
	:DateTime(std::chrono::system_clock::from_time_t(0))
{

}

DateTime::DateTime(TimePoint seconds, bool isUTC/*=true*/) :mTimePoint(seconds), mIsUTC(isUTC)
{
	if (mIsUTC)
	{
		UpdateTimePointToUTCDate();
	}
	else
	{
Ejemplo n.º 29
0
Array f_date_sun_info(int64_t ts, double latitude, double longitude) {
  return DateTime(ts, false).getSunInfo(latitude, longitude);
}
static long TestFileSystem(Handle<es::Context> root)
{
    long long creationTime;
    long long lastAccessTime;
    long long lastWriteTime;

    Handle<es::File>       file;

    const char* filename = "test.txt";

    // create file.
    DateTime d = DateTime::getNow();
    file = root->bind(filename, 0);
    DateTime end = DateTime::getNow();

    DateTime start = DateTime(d.getYear(), d.getMonth(), d.getDay(),
        d.getHour(), d.getMinute(), d.getSecond(), d.getMillisecond() - d.getMillisecond() % 10);

#ifdef VERBOSE
    DateTime dc(creationTime);
    esReport("creation %d/%d/%d %d:%d:%d.%d\n", dc.getYear(), dc.getMonth(),
                 dc.getDay(), dc.getHour(), dc.getMinute(),
                     dc.getSecond(), dc.getMillisecond());

    esReport("start    %d/%d/%d %d:%d:%d.%d\n", start.getYear(), start.getMonth(),
                 start.getDay(), start.getHour(), start.getMinute(),
                     start.getSecond(), start.getMillisecond());

    esReport("end      %d/%d/%d %d:%d:%d.%d\n", end.getYear(), end.getMonth(),
                 end.getDay(), end.getHour(), end.getMinute(),
                     end.getSecond(), end.getMillisecond());

#endif // VERBOSE

    // check creation time.
    creationTime = file->getCreationTime();

    TEST(start.getTicks() <= creationTime &&
         creationTime <= end.getTicks());

    // read and write data to the file.
    Handle<es::Stream> stream = file->getStream();

    d = DateTime::getNow();
    TestReadWrite(stream);
    end = DateTime::getNow();

    // check the last access time and the last write time.
    DateTime day = DateTime(d.getYear(), d.getMonth(), d.getDay(), 0, 0, 0);
    start = DateTime(d.getYear(), d.getMonth(), d.getDay(), d.getHour(), d.getMinute(),
        d.getSecond() - d.getSecond() % 2);

    lastAccessTime = file->getLastAccessTime();
    lastWriteTime = file->getLastWriteTime();

    TEST(day.getTicks() <= lastAccessTime &&
         lastAccessTime <= end.getTicks());
    TEST(start.getTicks() <= lastWriteTime &&
         lastWriteTime <= end.getTicks());

#ifdef VERBOSE
    DateTime da(lastAccessTime);
    esReport("last access time %d/%d/%d %d:%d:%d.%d\n", da.getYear(), da.getMonth(),
                 da.getDay(), da.getHour(), da.getMinute(),
                     da.getSecond(), da.getMillisecond());
    DateTime dw(lastWriteTime);
    esReport("start            %d/%d/%d %d:%d:%d.%d\n", start.getYear(), start.getMonth(),
                 start.getDay(), start.getHour(), start.getMinute(),
                     start.getSecond(), start.getMillisecond());
    esReport("lastWriteTime    %d/%d/%d %d:%d:%d.%d\n", dw.getYear(), dw.getMonth(),
                 dw.getDay(), dw.getHour(), dw.getMinute(), dw.getSecond(), dw.getMillisecond());
    esReport("end              %d/%d/%d %d:%d:%d.%d\n", end.getYear(), end.getMonth(),
                 end.getDay(), end.getHour(), end.getMinute(),
                     end.getSecond(), end.getMillisecond());
#endif

    // read the file, and check the last write time.
    u8 buf[512];

    d = DateTime::getNow();
    stream->read(buf, sizeof(buf));
    end = DateTime::getNow();

    start = DateTime(d.getYear(), d.getMonth(), d.getDay(),
        d.getHour(), d.getMinute(), d.getSecond());

    long long lastWriteTime2;
    lastWriteTime2 = file->getLastWriteTime();
    TEST(lastWriteTime == lastWriteTime2);

    long long creationTime2;
    creationTime2 = file->getCreationTime();
    TEST(creationTime == creationTime2);

    d = DateTime::getNow();
    DateTime now = DateTime(d.getYear(), d.getMonth(), d.getDay(),
        d.getHour(), d.getMinute(), d.getSecond(), d.getMillisecond() - d.getMillisecond() % 10);

    // check setCreationTime, setLastAccessTime and setLastWriteTime.
    file->setCreationTime(now.getTicks());
    creationTime = file->getCreationTime();
    TEST(now.getTicks() == creationTime);

    now = DateTime(d.getYear(), d.getMonth(), d.getDay(), 0, 0, 0, 0);
    file->setLastAccessTime(now.getTicks());
    lastAccessTime = file->getLastAccessTime();
    TEST(now.getTicks() == lastAccessTime);

    now = DateTime(d.getYear(), d.getMonth(), d.getDay(), d.getHour(), d.getMinute(),
        d.getSecond() - d.getSecond() % 2);
    file->setLastWriteTime(now.getTicks());
    lastWriteTime = file->getLastWriteTime();

    TEST(now.getTicks() == lastWriteTime);

    return 0;
}